├── LICENSE ├── README.md ├── ap6210_defconfig.patch ├── ap6210_module.patch ├── arch └── arm │ └── configs │ └── sun7i_defconfig ├── drivers └── net │ └── wireless │ └── ap6210 │ ├── Kconfig │ ├── Makefile │ ├── aiutils.c │ ├── ap6210.h │ ├── ap6210_gpio.h │ ├── ap6210_gpio_bt.c │ ├── ap6210_gpio_wifi.c │ ├── bcmevent.c │ ├── bcmsdh.c │ ├── bcmsdh_linux.c │ ├── bcmsdh_sdmmc.c │ ├── bcmsdh_sdmmc_linux.c │ ├── bcmutils.c │ ├── bcmwifi_channels.c │ ├── dhd.h │ ├── dhd_bta.c │ ├── dhd_bta.h │ ├── dhd_bus.h │ ├── dhd_cdc.c │ ├── dhd_cfg80211.c │ ├── dhd_cfg80211.h │ ├── dhd_common.c │ ├── dhd_custom_gpio.c │ ├── dhd_dbg.h │ ├── dhd_gpio.c │ ├── dhd_ip.c │ ├── dhd_ip.h │ ├── dhd_linux.c │ ├── dhd_linux_sched.c │ ├── dhd_pno.c │ ├── dhd_pno.h │ ├── dhd_proto.h │ ├── dhd_sdio.c │ ├── dhd_wlfc.c │ ├── dhd_wlfc.h │ ├── dngl_stats.h │ ├── dngl_wlhdr.h │ ├── hndpmu.c │ ├── include │ ├── Makefile │ ├── aidmp.h │ ├── bcm_cfg.h │ ├── bcm_mpool_pub.h │ ├── bcmcdc.h │ ├── bcmdefs.h │ ├── bcmdevs.h │ ├── bcmendian.h │ ├── bcmpcispi.h │ ├── bcmperf.h │ ├── bcmsdbus.h │ ├── bcmsdh.h │ ├── bcmsdh_sdmmc.h │ ├── bcmsdpcm.h │ ├── bcmsdspi.h │ ├── bcmsdstd.h │ ├── bcmspi.h │ ├── bcmutils.h │ ├── bcmwifi_channels.h │ ├── bcmwifi_rates.h │ ├── dhdioctl.h │ ├── epivers.h │ ├── hndpmu.h │ ├── hndrte_armtrap.h │ ├── hndrte_cons.h │ ├── hndsoc.h │ ├── linux_osl.h │ ├── linuxver.h │ ├── miniopt.h │ ├── msgtrace.h │ ├── osl.h │ ├── packed_section_end.h │ ├── packed_section_start.h │ ├── pcicfg.h │ ├── proto │ │ ├── 802.11.h │ │ ├── 802.11_bta.h │ │ ├── 802.11e.h │ │ ├── 802.1d.h │ │ ├── bcmeth.h │ │ ├── bcmevent.h │ │ ├── bcmip.h │ │ ├── bt_amp_hci.h │ │ ├── eapol.h │ │ ├── ethernet.h │ │ ├── p2p.h │ │ ├── sdspi.h │ │ ├── vlan.h │ │ └── wpa.h │ ├── sbchipc.h │ ├── sbconfig.h │ ├── sbhnddma.h │ ├── sbpcmcia.h │ ├── sbsdio.h │ ├── sbsdpcmdev.h │ ├── sbsocram.h │ ├── sdio.h │ ├── sdioh.h │ ├── sdiovar.h │ ├── siutils.h │ ├── trxhdr.h │ ├── typedefs.h │ ├── wlfc_proto.h │ └── wlioctl.h │ ├── linux_osl.c │ ├── sbutils.c │ ├── siutils.c │ ├── siutils_priv.h │ ├── uamp_api.h │ ├── wl_android.c │ ├── wl_android.h │ ├── wl_cfg80211.c │ ├── wl_cfg80211.h │ ├── wl_cfgp2p.c │ ├── wl_cfgp2p.h │ ├── wl_iw.c │ ├── wl_iw.h │ ├── wl_linux_mon.c │ ├── wldev_common.c │ └── wldev_common.h └── firmware ├── Makefile └── ap6210 ├── bcm20710a1.hcd.ihex ├── fw_bcm40181a2.bin.ihex ├── fw_bcm40181a2_apsta.bin.ihex ├── fw_bcm40181a2_p2p.bin.ihex └── nvram_ap6210.txt.ihex /README.md: -------------------------------------------------------------------------------- 1 | ap6210 2 | ====== 3 | 4 | Wifi and Bluetooth driver for CubieTruck. 5 | 6 | This patch should be applied to the root of the linux-sunxi kernel's source : 7 | 8 | # patch -p1 < ap6210_defconfig.patch 9 | # patch -p1 < ap6210_module.patch 10 | 11 | The driver use GPIO 2 as the IRQ for host wakeup, this need to be setup in script.bin. Add theses lines to the board's fex and generate a new script.bin (fex2bin cubietruck.fex script.bin) 12 | 13 | [gpio_para] 14 | gpio_used = 1 15 | gpio_num = 2 16 | gpio_pin_1 = port:PH20<1><1> 17 | gpio_pin_2 = port:PH10<0><0> 18 | 19 | To load the module, add the following line to /etc/modules : 20 | 21 | ap6210 22 | 23 | Feel free to improve the code and submit bugfix... 24 | 25 | -------------------------------------------------------------------------------- /ap6210_defconfig.patch: -------------------------------------------------------------------------------- 1 | diff -uNr linux-sunxi/arch/arm/configs/sun7i_defconfig linux-sunxi-ap6210/arch/arm/configs/sun7i_defconfig 2 | --- linux-sunxi-o/arch/arm/configs/sun7i_defconfig 2014-05-30 18:33:05.650561315 -0400 3 | +++ linux-sunxi-n/arch/arm/configs/sun7i_defconfig 2014-05-30 19:50:29.914561315 -0400 4 | @@ -539,7 +539,12 @@ 5 | CONFIG_B43_PHY_N=y 6 | CONFIG_B43_PHY_HT=y 7 | CONFIG_B43LEGACY=m 8 | -CONFIG_BCMDHD=m 9 | +# CONFIG_BCMDHD is not set 10 | +CONFIG_AP6210=m 11 | +CONFIG_AP6210_FW_PATH="/lib/firmware/ap6210/fw_bcmxxxx.bin" 12 | +CONFIG_AP6210_NVRAM_PATH="/lib/firmware/ap6210/nvram_apxxxx.txt" 13 | +CONFIG_AP6210_OOB=y 14 | +# CONFIG_AP6210_SDIO_IRQ is not set 15 | CONFIG_BRCMFMAC=m 16 | CONFIG_BRCMFMAC_USB=y 17 | CONFIG_HOSTAP=m 18 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/Kconfig: -------------------------------------------------------------------------------- 1 | config AP6210 2 | tristate "AMPAK AP6210 wireless/bluetooth module support" 3 | depends on MMC 4 | default n 5 | ---help--- 6 | This module adds support for the wireless and bluetooth 7 | module of the CubieTruck. 8 | 9 | config AP6210_FW_PATH 10 | depends on AP6210 11 | string "Firmware path" 12 | default "/system/vendor/modules/fw_bcmxxxx.bin" 13 | ---help--- 14 | Path to the firmware file. 15 | 16 | config AP6210_NVRAM_PATH 17 | depends on AP6210 18 | string "NVRAM path" 19 | default "/system/vendor/modules/nvram_apxxxx.txt" 20 | ---help--- 21 | Path to the calibration file. 22 | 23 | config AP6210_WEXT 24 | bool "Enable WEXT support" 25 | depends on AP6210 && CFG80211 = n 26 | select WIRELESS_EXT 27 | select WEXT_PRIV 28 | help 29 | Enables WEXT support 30 | 31 | choice 32 | depends on AP6210 33 | prompt "Interrupt type" 34 | config AP6210_OOB 35 | depends on AP6210 36 | bool "Out-of-Band Interrupt" 37 | ---help--- 38 | Interrupt through WL_HOST_WAKE. 39 | config AP6210_SDIO_IRQ 40 | depends on AP6210 41 | bool "In-Band Interrupt" 42 | default y 43 | ---help--- 44 | Interrupt through SDIO DAT[1] 45 | endchoice 46 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/Makefile: -------------------------------------------------------------------------------- 1 | # ap6210 2 | DHDCFLAGS = -Wall -Wstrict-prototypes -Dlinux -DBCMDRIVER \ 3 | -DBCMDONGLEHOST -DUNRELEASEDCHIP -DBCMDMA32 -DBCMFILEIMAGE \ 4 | -DDHDTHREAD -DDHD_DEBUG -DSDTEST -DBDC -DTOE \ 5 | -DDHD_BCMEVENTS -DSHOW_EVENTS -DPROP_TXSTATUS -DBCMDBG \ 6 | -DMMC_SDIO_ABORT -DBCMSDIO -DBCMLXSDMMC -DBCMPLATFORM_BUS -DWLP2P \ 7 | -DWIFI_ACT_FRAME -DARP_OFFLOAD_SUPPORT \ 8 | -DKEEP_ALIVE -DPKT_FILTER_SUPPORT \ 9 | -DEMBEDDED_PLATFORM -DENABLE_INSMOD_NO_FW_LOAD -DPNO_SUPPORT \ 10 | -DDHD_USE_IDLECOUNT -DSET_RANDOM_MAC_SOFTAP -DVSDB \ 11 | -DWL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST -DSDIO_CRC_ERROR_FIX \ 12 | -DESCAN_RESULT_PATCH -DHT40_GO -DPASS_ARP_PACKET -DSUPPORT_PM2_ONLY \ 13 | -DDHD_DONOT_FORWARD_BCMEVENT_AS_NETWORK_PKT -DAMPDU_HOSTREORDER \ 14 | -DDISABLE_FW_ROAM_SUSPEND -DDISABLE_BUILTIN_ROAM \ 15 | -DCUSTOM_SDIO_F2_BLKSIZE=128 -DWL_SDO -DWL_SUPPORT_BACKPORTED_KPATCHES\ 16 | -Idrivers/net/wireless/ap6210 -Idrivers/net/wireless/ap6210/include 17 | 18 | DHDOFILES = aiutils.o bcmsdh_sdmmc_linux.o dhd_linux.o siutils.o bcmutils.o \ 19 | dhd_linux_sched.o dhd_sdio.o bcmwifi_channels.o bcmevent.o hndpmu.o \ 20 | bcmsdh.o dhd_cdc.o bcmsdh_linux.o dhd_common.o linux_osl.o \ 21 | bcmsdh_sdmmc.o dhd_custom_gpio.o sbutils.o wldev_common.o wl_android.o \ 22 | ap6210_gpio_wifi.o ap6210_gpio_bt.o 23 | 24 | obj-$(CONFIG_AP6210) += ap6210.o 25 | ap6210-objs += $(DHDOFILES) 26 | 27 | DHDOFILES += dhd_gpio.o 28 | DHDCFLAGS += -DCUSTOMER_HW 29 | #DHDCFLAGS += -DBCMWAPI_WPI -DBCMWAPI_WAI 30 | 31 | ifeq ($(CONFIG_AP6210_OOB),y) 32 | DHDCFLAGS += -DOOB_INTR_ONLY -DHW_OOB -DCUSTOMER_OOB 33 | else 34 | DHDCFLAGS += -DSDIO_ISR_THREAD 35 | endif 36 | 37 | ifeq ($(CONFIG_AP6210_AG),y) 38 | DHDCFLAGS += -DBAND_AG 39 | endif 40 | 41 | ifneq ($(CONFIG_WIRELESS_EXT),) 42 | ap6210-objs += wl_iw.o 43 | DHDCFLAGS += -DSOFTAP -DWL_WIRELESS_EXT -DUSE_IW 44 | endif 45 | ifneq ($(CONFIG_CFG80211),) 46 | ap6210-objs += wl_cfg80211.o wl_cfgp2p.o wl_linux_mon.o dhd_cfg80211.o 47 | DHDCFLAGS += -DWL_CFG80211 -DWL_CFG80211_STA_EVENT -DWL_ENABLE_P2P_IF 48 | DHDCFLAGS += -DCUSTOM_ROAM_TRIGGER_SETTING=-65 49 | DHDCFLAGS += -DCUSTOM_ROAM_DELTA_SETTING=15 50 | DHDCFLAGS += -DCUSTOM_KEEP_ALIVE_SETTING=28000 51 | DHDCFLAGS += -DCUSTOM_PNO_EVENT_LOCK_xTIME=7 52 | DHDCFLAGS += -fno-aggressive-loop-optimizations 53 | endif 54 | ifneq ($(CONFIG_DHD_USE_SCHED_SCAN),) 55 | DHDCFLAGS += -DWL_SCHED_SCAN 56 | endif 57 | EXTRA_CFLAGS = $(DHDCFLAGS) 58 | ifeq ($(CONFIG_AP6210),m) 59 | EXTRA_LDFLAGS += --strip-debug 60 | endif 61 | 62 | # GPIO Power Management Modules 63 | 64 | #obj-$(CONFIG_AP6210) += ap6210_gpio_wifi.o 65 | #obj-$(CONFIG_AP6210) += ap6210_gpio_bt.o 66 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/ap6210.h: -------------------------------------------------------------------------------- 1 | #ifndef __AP6210_H__ 2 | #define __AP6210_H__ 3 | 4 | #define AP6210_EMERG(...) pr_emerg("[ap6210] "__VA_ARGS__) 5 | #define AP6210_ALERT(...) pr_alert("[ap6210] "__VA_ARGS__) 6 | #define AP6210_CRIT(...) pr_crit("[ap6210] "__VA_ARGS__) 7 | #define AP6210_ERR(...) pr_err("[ap6210] "__VA_ARGS__) 8 | #define AP6210_WARN(...) pr_warn("[ap6210] "__VA_ARGS__) 9 | #define AP6210_NOTICE(...) pr_notice("[ap6210] "__VA_ARGS__) 10 | #define AP6210_INFO(...) pr_info("[ap6210] "__VA_ARGS__) 11 | #define AP6210_DEBUG(...) pr_debug("[ap6210] "__VA_ARGS__) 12 | #define AP6210_DUMP(...) pr_debug(__VA_ARGS__) 13 | #define AP6210_CONT(...) pr_cont(__VA_ARGS__) 14 | 15 | extern int __init sw_rfkill_init(void); 16 | extern void __exit sw_rfkill_exit(void); 17 | 18 | extern int __init ap6210_gpio_wifi_init(void); 19 | extern void __exit ap6210_gpio_wifi_exit(void); 20 | 21 | 22 | #endif /* __AP6210_H__ */ 23 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/ap6210_gpio.h: -------------------------------------------------------------------------------- 1 | #ifndef __AP6210_GPIO_H__ 2 | #define __AP6210_GPIO_H__ 3 | 4 | extern int ap6210_gpio_wifi_get_mod_type(void); 5 | extern int ap6210_gpio_wifi_gpio_ctrl(char* name, int level); 6 | extern void ap6210_gpio_wifi_power(int on); 7 | extern char *ap6210_gpio_wifi_get_name(int module_sel); 8 | 9 | #endif /* __AP6210_GPIO_H__ */ 10 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/ap6210_gpio_bt.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #if (defined CONFIG_MMC) 9 | #include "ap6210_gpio.h" 10 | #else 11 | static __inline int ap6210_gpio_wifi_get_mod_type(void) 12 | { 13 | AP6210_DEBUG("%s : not implemented!\n", __FUNCTION__ ); 14 | return 0; 15 | } 16 | static __inline int ap6210_gpio_wifi_gpio_ctrl(char* name, int level) 17 | { 18 | AP6210_DEBUG("%s : not implemented!\n", __FUNCTION__ ); 19 | return -1; 20 | } 21 | #endif 22 | 23 | #include 24 | 25 | static const char bt_name[] = "bcm40183"; 26 | static struct rfkill *sw_rfkill; 27 | static int bt_used; 28 | 29 | static int rfkill_set_power(void *data, bool blocked) 30 | { 31 | unsigned int mod_sel = ap6210_gpio_wifi_get_mod_type(); 32 | 33 | AP6210_DEBUG("rfkill set power %s\n", ( blocked ? "blocked" : "unblocked" )); 34 | 35 | switch (mod_sel) 36 | { 37 | case 2: /* bcm40183 */ 38 | if (!blocked) { 39 | ap6210_gpio_wifi_gpio_ctrl("bcm40183_bt_regon", 1); 40 | ap6210_gpio_wifi_gpio_ctrl("bcm40183_bt_rst", 1); 41 | } else { 42 | ap6210_gpio_wifi_gpio_ctrl("bcm40183_bt_rst", 0); 43 | ap6210_gpio_wifi_gpio_ctrl("bcm40183_bt_regon", 0); 44 | } 45 | AP6210_ERR("Using %s configuration.\n", ap6210_gpio_wifi_get_name(mod_sel) ); 46 | break; 47 | case 3: /* realtek rtl8723as */ 48 | if (!blocked) { 49 | ap6210_gpio_wifi_gpio_ctrl("rtk_rtl8723as_bt_dis", 1); 50 | } else { 51 | ap6210_gpio_wifi_gpio_ctrl("rtk_rtl8723as_bt_dis", 0); 52 | } 53 | AP6210_ERR("Using %s configuration.\n", ap6210_gpio_wifi_get_name(mod_sel) ); 54 | break; 55 | case 7: /* ap6210 */ 56 | case 8: /* ap6330 */ 57 | if (!blocked) { 58 | ap6210_gpio_wifi_gpio_ctrl("ap6xxx_bt_regon", 1); 59 | } else { 60 | ap6210_gpio_wifi_gpio_ctrl("ap6xxx_bt_regon", 0); 61 | } 62 | AP6210_ERR("Using %s configuration.\n", ap6210_gpio_wifi_get_name(mod_sel) ); 63 | break; 64 | case 10: /* realtek rtl8723au */ 65 | if (!blocked) { 66 | ap6210_gpio_wifi_gpio_ctrl("rtl8723au_bt", 1); 67 | } else { 68 | ap6210_gpio_wifi_gpio_ctrl("rtl8723au_bt", 0); 69 | } 70 | AP6210_ERR("Using %s configuration.\n", ap6210_gpio_wifi_get_name(mod_sel) ); 71 | break; 72 | default: 73 | AP6210_ERR("no bluetooth module matched.\n" ); 74 | } 75 | 76 | msleep(10); 77 | return 0; 78 | } 79 | 80 | static struct rfkill_ops sw_rfkill_ops = { 81 | .set_block = rfkill_set_power, 82 | }; 83 | 84 | static int sw_rfkill_probe(struct platform_device *pdev) 85 | { 86 | int ret = 0; 87 | 88 | sw_rfkill = rfkill_alloc(bt_name, &pdev->dev, 89 | RFKILL_TYPE_BLUETOOTH, &sw_rfkill_ops, NULL); 90 | if (unlikely(!sw_rfkill)) { 91 | AP6210_DEBUG("Unable to alocate rfkill structure.\n" ); 92 | return -ENOMEM; 93 | } 94 | 95 | ret = rfkill_register(sw_rfkill); 96 | if (unlikely(ret)) { 97 | AP6210_DEBUG("Unable to register rfkill structure.\n" ); 98 | rfkill_destroy(sw_rfkill); 99 | } 100 | AP6210_DEBUG("rfkill structure registered successfully.\n" ); 101 | return ret; 102 | } 103 | 104 | static int sw_rfkill_remove(struct platform_device *pdev) 105 | { 106 | if (likely(sw_rfkill)) { 107 | rfkill_unregister(sw_rfkill); 108 | rfkill_destroy(sw_rfkill); 109 | AP6210_DEBUG("rfkill structure removed successfully.\n" ); 110 | } 111 | 112 | return 0; 113 | } 114 | 115 | static struct platform_driver sw_rfkill_driver = { 116 | .probe = sw_rfkill_probe, 117 | .remove = sw_rfkill_remove, 118 | .driver = { 119 | .name = "sunxi-rfkill", 120 | .owner = THIS_MODULE, 121 | }, 122 | }; 123 | 124 | static struct platform_device sw_rfkill_dev = { 125 | .name = "sunxi-rfkill", 126 | }; 127 | 128 | int __init sw_rfkill_init(void) 129 | { 130 | if (SCRIPT_PARSER_OK != script_parser_fetch("bt_para", "bt_used", &bt_used, 1)) { 131 | AP6210_DEBUG("parse bt_used failed in script.fex.\n" ); 132 | return -1; 133 | } 134 | 135 | if (!bt_used) { 136 | AP6210_ERR("bluetooth is disable in script.fex.\n" ); 137 | return 0; 138 | } 139 | 140 | platform_device_register(&sw_rfkill_dev); 141 | AP6210_ERR("platform device registered successfully.\n" ); 142 | return platform_driver_register(&sw_rfkill_driver); 143 | } 144 | 145 | void __exit sw_rfkill_exit(void) 146 | { 147 | if (!bt_used) { 148 | AP6210_ERR("exit no bt used in configuration\n" ); 149 | return ; 150 | } 151 | 152 | platform_device_unregister(&sw_rfkill_dev); 153 | platform_driver_unregister(&sw_rfkill_driver); 154 | } 155 | 156 | /* 157 | module_init(sw_rfkill_init); 158 | module_exit(sw_rfkill_exit); 159 | 160 | MODULE_DESCRIPTION("sunxi-rfkill driver"); 161 | MODULE_AUTHOR("Aaron.magic"); 162 | MODULE_LICENSE("GPL"); 163 | */ 164 | 165 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/bcmevent.c: -------------------------------------------------------------------------------- 1 | /* 2 | * bcmevent read-only data shared by kernel or app layers 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * $Id: bcmevent.c 370587 2012-11-22 09:32:38Z $ 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #if WLC_E_LAST != 107 34 | #error "You need to add an entry to bcmevent_names[] for the new event" 35 | #endif 36 | 37 | const bcmevent_name_t bcmevent_names[] = { 38 | { WLC_E_SET_SSID, "SET_SSID" }, 39 | { WLC_E_JOIN, "JOIN" }, 40 | { WLC_E_START, "START" }, 41 | { WLC_E_AUTH, "AUTH" }, 42 | { WLC_E_AUTH_IND, "AUTH_IND" }, 43 | { WLC_E_DEAUTH, "DEAUTH" }, 44 | { WLC_E_DEAUTH_IND, "DEAUTH_IND" }, 45 | { WLC_E_ASSOC, "ASSOC" }, 46 | { WLC_E_ASSOC_IND, "ASSOC_IND" }, 47 | { WLC_E_REASSOC, "REASSOC" }, 48 | { WLC_E_REASSOC_IND, "REASSOC_IND" }, 49 | { WLC_E_DISASSOC, "DISASSOC" }, 50 | { WLC_E_DISASSOC_IND, "DISASSOC_IND" }, 51 | { WLC_E_QUIET_START, "START_QUIET" }, 52 | { WLC_E_QUIET_END, "END_QUIET" }, 53 | { WLC_E_BEACON_RX, "BEACON_RX" }, 54 | { WLC_E_LINK, "LINK" }, 55 | { WLC_E_MIC_ERROR, "MIC_ERROR" }, 56 | { WLC_E_NDIS_LINK, "NDIS_LINK" }, 57 | { WLC_E_ROAM, "ROAM" }, 58 | { WLC_E_TXFAIL, "TXFAIL" }, 59 | { WLC_E_PMKID_CACHE, "PMKID_CACHE" }, 60 | { WLC_E_RETROGRADE_TSF, "RETROGRADE_TSF" }, 61 | { WLC_E_PRUNE, "PRUNE" }, 62 | { WLC_E_AUTOAUTH, "AUTOAUTH" }, 63 | { WLC_E_EAPOL_MSG, "EAPOL_MSG" }, 64 | { WLC_E_SCAN_COMPLETE, "SCAN_COMPLETE" }, 65 | { WLC_E_ADDTS_IND, "ADDTS_IND" }, 66 | { WLC_E_DELTS_IND, "DELTS_IND" }, 67 | { WLC_E_BCNSENT_IND, "BCNSENT_IND" }, 68 | { WLC_E_BCNRX_MSG, "BCNRX_MSG" }, 69 | { WLC_E_BCNLOST_MSG, "BCNLOST_IND" }, 70 | { WLC_E_ROAM_PREP, "ROAM_PREP" }, 71 | { WLC_E_PFN_NET_FOUND, "PFNFOUND_IND" }, 72 | { WLC_E_PFN_NET_LOST, "PFNLOST_IND" }, 73 | #if defined(IBSS_PEER_DISCOVERY_EVENT) 74 | { WLC_E_IBSS_ASSOC, "IBSS_ASSOC" }, 75 | #endif /* defined(IBSS_PEER_DISCOVERY_EVENT) */ 76 | { WLC_E_RADIO, "RADIO" }, 77 | { WLC_E_PSM_WATCHDOG, "PSM_WATCHDOG" }, 78 | { WLC_E_PROBREQ_MSG, "PROBE_REQ_MSG" }, 79 | { WLC_E_SCAN_CONFIRM_IND, "SCAN_CONFIRM_IND" }, 80 | { WLC_E_PSK_SUP, "PSK_SUP" }, 81 | { WLC_E_COUNTRY_CODE_CHANGED, "CNTRYCODE_IND" }, 82 | { WLC_E_EXCEEDED_MEDIUM_TIME, "EXCEEDED_MEDIUM_TIME" }, 83 | { WLC_E_ICV_ERROR, "ICV_ERROR" }, 84 | { WLC_E_UNICAST_DECODE_ERROR, "UNICAST_DECODE_ERROR" }, 85 | { WLC_E_MULTICAST_DECODE_ERROR, "MULTICAST_DECODE_ERROR" }, 86 | { WLC_E_TRACE, "TRACE" }, 87 | #ifdef WLBTAMP 88 | { WLC_E_BTA_HCI_EVENT, "BTA_HCI_EVENT" }, 89 | #endif 90 | { WLC_E_IF, "IF" }, 91 | #ifdef WLP2P 92 | { WLC_E_P2P_DISC_LISTEN_COMPLETE, "WLC_E_P2P_DISC_LISTEN_COMPLETE" }, 93 | #endif 94 | { WLC_E_RSSI, "RSSI" }, 95 | { WLC_E_PFN_SCAN_COMPLETE, "SCAN_COMPLETE" }, 96 | { WLC_E_EXTLOG_MSG, "EXTERNAL LOG MESSAGE" }, 97 | #ifdef WIFI_ACT_FRAME 98 | { WLC_E_ACTION_FRAME, "ACTION_FRAME" }, 99 | { WLC_E_ACTION_FRAME_RX, "ACTION_FRAME_RX" }, 100 | { WLC_E_ACTION_FRAME_COMPLETE, "ACTION_FRAME_COMPLETE" }, 101 | #endif 102 | #ifdef BCMWAPI_WAI 103 | { WLC_E_WAI_STA_EVENT, "WAI_STA_EVENT" }, 104 | { WLC_E_WAI_MSG, "WAI_MSG" }, 105 | #endif /* BCMWAPI_WAI */ 106 | #if 0 && (NDISVER >= 0x0620) 107 | { WLC_E_PRE_ASSOC_IND, "ASSOC_RECV" }, 108 | { WLC_E_PRE_REASSOC_IND, "REASSOC_RECV" }, 109 | { WLC_E_CHANNEL_ADOPTED, "CHANNEL_ADOPTED" }, 110 | { WLC_E_AP_STARTED, "AP_STARTED" }, 111 | { WLC_E_DFS_AP_STOP, "DFS_AP_STOP" }, 112 | { WLC_E_DFS_AP_RESUME, "DFS_AP_RESUME" }, 113 | { WLC_E_ASSOC_IND_NDIS, "ASSOC_IND_NDIS"}, 114 | { WLC_E_REASSOC_IND_NDIS, "REASSOC_IND_NDIS"}, 115 | { WLC_E_ACTION_FRAME_RX_NDIS, "WLC_E_ACTION_FRAME_RX_NDIS" }, 116 | { WLC_E_AUTH_REQ, "WLC_E_AUTH_REQ" }, 117 | #endif 118 | { WLC_E_ESCAN_RESULT, "WLC_E_ESCAN_RESULT" }, 119 | { WLC_E_ACTION_FRAME_OFF_CHAN_COMPLETE, "WLC_E_AF_OFF_CHAN_COMPLETE" }, 120 | #ifdef WLP2P 121 | { WLC_E_PROBRESP_MSG, "PROBE_RESP_MSG" }, 122 | { WLC_E_P2P_PROBREQ_MSG, "P2P PROBE_REQ_MSG" }, 123 | #endif 124 | #ifdef PROP_TXSTATUS 125 | { WLC_E_FIFO_CREDIT_MAP, "FIFO_CREDIT_MAP" }, 126 | #endif 127 | { WLC_E_WAKE_EVENT, "WAKE_EVENT" }, 128 | { WLC_E_DCS_REQUEST, "DCS_REQUEST" }, 129 | { WLC_E_RM_COMPLETE, "RM_COMPLETE" }, 130 | #ifdef WLMEDIA_HTSF 131 | { WLC_E_HTSFSYNC, "HTSF_SYNC_EVENT" }, 132 | #endif 133 | { WLC_E_OVERLAY_REQ, "OVERLAY_REQ_EVENT" }, 134 | { WLC_E_CSA_COMPLETE_IND, "WLC_E_CSA_COMPLETE_IND"}, 135 | { WLC_E_EXCESS_PM_WAKE_EVENT, "EXCESS_PM_WAKE_EVENT" }, 136 | { WLC_E_PFN_SCAN_NONE, "PFN_SCAN_NONE" }, 137 | { WLC_E_PFN_SCAN_ALLGONE, "PFN_SCAN_ALLGONE" }, 138 | #ifdef SOFTAP 139 | { WLC_E_GTK_PLUMBED, "GTK_PLUMBED" }, 140 | #endif 141 | { WLC_E_ASSOC_REQ_IE, "ASSOC_REQ_IE" }, 142 | { WLC_E_ASSOC_RESP_IE, "ASSOC_RESP_IE" }, 143 | { WLC_E_ACTION_FRAME_RX_NDIS, "WLC_E_ACTION_FRAME_RX_NDIS" }, 144 | #ifdef WLTDLS 145 | { WLC_E_TDLS_PEER_EVENT, "TDLS_PEER_EVENT" }, 146 | #endif /* WLTDLS */ 147 | { WLC_E_SERVICE_FOUND, "SERVICE_FOUND" }, 148 | { WLC_E_P2PO_ADD_DEVICE, "P2PO_DEV_FOUND" }, 149 | { WLC_E_P2PO_DEL_DEVICE, "P2PO_DEV_LOST" }, 150 | }; 151 | 152 | const int bcmevent_names_size = ARRAYSIZE(bcmevent_names); 153 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/dhd_bta.h: -------------------------------------------------------------------------------- 1 | /* 2 | * BT-AMP support routines 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: dhd_bta.h 291086 2011-10-21 01:17:24Z $ 25 | */ 26 | #ifndef __dhd_bta_h__ 27 | #define __dhd_bta_h__ 28 | 29 | struct dhd_pub; 30 | 31 | extern int dhd_bta_docmd(struct dhd_pub *pub, void *cmd_buf, uint cmd_len); 32 | 33 | extern void dhd_bta_doevt(struct dhd_pub *pub, void *data_buf, uint data_len); 34 | 35 | extern int dhd_bta_tx_hcidata(struct dhd_pub *pub, void *data_buf, uint data_len); 36 | extern void dhd_bta_tx_hcidata_complete(struct dhd_pub *dhdp, void *txp, bool success); 37 | 38 | 39 | #endif /* __dhd_bta_h__ */ 40 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/dhd_bus.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Header file describing the internal (inter-module) DHD interfaces. 3 | * 4 | * Provides type definitions and function prototypes used to link the 5 | * DHD OS, bus, and protocol modules. 6 | * 7 | * Copyright (C) 1999-2012, Broadcom Corporation 8 | * 9 | * Unless you and Broadcom execute a separate written software license 10 | * agreement governing use of this software, this software is licensed to you 11 | * under the terms of the GNU General Public License version 2 (the "GPL"), 12 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 13 | * following added to such license: 14 | * 15 | * As a special exception, the copyright holders of this software give you 16 | * permission to link this software with independent modules, and to copy and 17 | * distribute the resulting executable under terms of your choice, provided that 18 | * you also meet, for each linked independent module, the terms and conditions of 19 | * the license of that module. An independent module is a module which is not 20 | * derived from this software. The special exception does not apply to any 21 | * modifications of the software. 22 | * 23 | * Notwithstanding the above, under no circumstances may you combine this 24 | * software in any way with any other Broadcom software provided under a license 25 | * other than the GPL, without Broadcom's express prior written consent. 26 | * 27 | * $Id: dhd_bus.h 347614 2012-07-27 10:24:51Z $ 28 | */ 29 | 30 | #ifndef _dhd_bus_h_ 31 | #define _dhd_bus_h_ 32 | 33 | /* 34 | * Exported from dhd bus module (dhd_usb, dhd_sdio) 35 | */ 36 | 37 | /* Indicate (dis)interest in finding dongles. */ 38 | extern int dhd_bus_register(void); 39 | extern void dhd_bus_unregister(void); 40 | 41 | /* Download firmware image and nvram image */ 42 | extern bool dhd_bus_download_firmware(struct dhd_bus *bus, osl_t *osh, 43 | char *fw_path, char *nv_path); 44 | 45 | /* Stop bus module: clear pending frames, disable data flow */ 46 | extern void dhd_bus_stop(struct dhd_bus *bus, bool enforce_mutex); 47 | 48 | /* Initialize bus module: prepare for communication w/dongle */ 49 | extern int dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex); 50 | 51 | /* Get the Bus Idle Time */ 52 | extern void dhd_bus_getidletime(dhd_pub_t *dhdp, int *idletime); 53 | 54 | /* Set the Bus Idle Time */ 55 | extern void dhd_bus_setidletime(dhd_pub_t *dhdp, int idle_time); 56 | 57 | /* Send a data frame to the dongle. Callee disposes of txp. */ 58 | extern int dhd_bus_txdata(struct dhd_bus *bus, void *txp, bool wlfc_locked); 59 | 60 | /* Send/receive a control message to/from the dongle. 61 | * Expects caller to enforce a single outstanding transaction. 62 | */ 63 | extern int dhd_bus_txctl(struct dhd_bus *bus, uchar *msg, uint msglen); 64 | extern int dhd_bus_rxctl(struct dhd_bus *bus, uchar *msg, uint msglen); 65 | 66 | /* Watchdog timer function */ 67 | extern bool dhd_bus_watchdog(dhd_pub_t *dhd); 68 | extern void dhd_disable_intr(dhd_pub_t *dhd); 69 | 70 | #if defined(DHD_DEBUG) 71 | /* Device console input function */ 72 | extern int dhd_bus_console_in(dhd_pub_t *dhd, uchar *msg, uint msglen); 73 | #endif /* defined(DHD_DEBUG) */ 74 | 75 | /* Deferred processing for the bus, return TRUE requests reschedule */ 76 | extern bool dhd_bus_dpc(struct dhd_bus *bus); 77 | extern void dhd_bus_isr(bool * InterruptRecognized, bool * QueueMiniportHandleInterrupt, void *arg); 78 | 79 | 80 | /* Check for and handle local prot-specific iovar commands */ 81 | extern int dhd_bus_iovar_op(dhd_pub_t *dhdp, const char *name, 82 | void *params, int plen, void *arg, int len, bool set); 83 | 84 | /* Add bus dump output to a buffer */ 85 | extern void dhd_bus_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf); 86 | 87 | /* Clear any bus counters */ 88 | extern void dhd_bus_clearcounts(dhd_pub_t *dhdp); 89 | 90 | /* return the dongle chipid */ 91 | extern uint dhd_bus_chip(struct dhd_bus *bus); 92 | 93 | /* Set user-specified nvram parameters. */ 94 | extern void dhd_bus_set_nvram_params(struct dhd_bus * bus, const char *nvram_params); 95 | 96 | extern void *dhd_bus_pub(struct dhd_bus *bus); 97 | extern void *dhd_bus_txq(struct dhd_bus *bus); 98 | extern uint dhd_bus_hdrlen(struct dhd_bus *bus); 99 | 100 | 101 | #define DHD_SET_BUS_STATE_DOWN(_bus) do { \ 102 | (_bus)->dhd->busstate = DHD_BUS_DOWN; \ 103 | } while (0) 104 | 105 | /* Register a dummy SDIO client driver in order to be notified of new SDIO device */ 106 | extern int dhd_bus_reg_sdio_notify(void* semaphore); 107 | extern void dhd_bus_unreg_sdio_notify(void); 108 | 109 | extern void dhd_txglom_enable(dhd_pub_t *dhdp, bool enable); 110 | 111 | #endif /* _dhd_bus_h_ */ 112 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/dhd_cfg80211.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Linux cfg80211 driver - Dongle Host Driver (DHD) related 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: wl_cfg80211.c,v 1.1.4.1.2.14 2011/02/09 01:40:07 Exp $ 25 | */ 26 | 27 | 28 | #ifndef __DHD_CFG80211__ 29 | #define __DHD_CFG80211__ 30 | 31 | #include 32 | #include 33 | 34 | s32 dhd_cfg80211_init(struct wl_priv *wl); 35 | s32 dhd_cfg80211_deinit(struct wl_priv *wl); 36 | s32 dhd_cfg80211_down(struct wl_priv *wl); 37 | s32 dhd_cfg80211_set_p2p_info(struct wl_priv *wl, int val); 38 | s32 dhd_cfg80211_clean_p2p_info(struct wl_priv *wl); 39 | s32 dhd_config_dongle(struct wl_priv *wl, bool need_lock); 40 | 41 | int wl_cfg80211_btcoex_init(struct wl_priv *wl); 42 | void wl_cfg80211_btcoex_deinit(struct wl_priv *wl); 43 | 44 | #endif /* __DHD_CFG80211__ */ 45 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/dhd_dbg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Debug/trace/assert driver definitions for Dongle Host Driver. 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: dhd_dbg.h 353490 2012-08-27 21:10:02Z $ 25 | */ 26 | 27 | #ifndef _dhd_dbg_ 28 | #define _dhd_dbg_ 29 | 30 | #define USE_NET_RATELIMIT net_ratelimit() 31 | 32 | #if defined(DHD_DEBUG) 33 | 34 | #define DHD_ERROR_ON() (dhd_msg_level & DHD_ERROR_VAL) 35 | #define DHD_TRACE_ON() (dhd_msg_level & DHD_TRACE_VAL) 36 | #define DHD_INFO_ON() (dhd_msg_level & DHD_INFO_VAL) 37 | #define DHD_DATA_ON() (dhd_msg_level & DHD_DATA_VAL) 38 | #define DHD_CTL_ON() (dhd_msg_level & DHD_CTL_VAL) 39 | #define DHD_TIMER_ON() (dhd_msg_level & DHD_TIMER_VAL) 40 | #define DHD_HDRS_ON() (dhd_msg_level & DHD_HDRS_VAL) 41 | #define DHD_BYTES_ON() (dhd_msg_level & DHD_BYTES_VAL) 42 | #define DHD_INTR_ON() (dhd_msg_level & DHD_INTR_VAL) 43 | #define DHD_GLOM_ON() (dhd_msg_level & DHD_GLOM_VAL) 44 | #define DHD_EVENT_ON() (dhd_msg_level & DHD_EVENT_VAL) 45 | #define DHD_BTA_ON() (dhd_msg_level & DHD_BTA_VAL) 46 | #define DHD_ISCAN_ON() (dhd_msg_level & DHD_ISCAN_VAL) 47 | #define DHD_ARPOE_ON() (dhd_msg_level & DHD_ARPOE_VAL) 48 | #define DHD_REORDER_ON() (dhd_msg_level & DHD_REORDER_VAL) 49 | 50 | #else /* defined(BCMDBG) || defined(DHD_DEBUG) */ 51 | 52 | #define DHD_ERROR_ON() 0 53 | #define DHD_TRACE_ON() 0 54 | #define DHD_INFO_ON() 0 55 | #define DHD_DATA_ON() 0 56 | #define DHD_CTL_ON() 0 57 | #define DHD_TIMER_ON() 0 58 | #define DHD_HDRS_ON() 0 59 | #define DHD_BYTES_ON() 0 60 | #define DHD_INTR_ON() 0 61 | #define DHD_GLOM_ON() 0 62 | #define DHD_EVENT_ON() 0 63 | #define DHD_BTA_ON() 0 64 | #define DHD_ISCAN_ON() 0 65 | #define DHD_ARPOE_ON() 0 66 | #define DHD_REORDER_ON() 0 67 | #endif 68 | 69 | #define DHD_LOG(args) 70 | 71 | #define DHD_BLOG(cp, size) 72 | 73 | #define DHD_NONE(args) 74 | extern int dhd_msg_level; 75 | 76 | /* Defines msg bits */ 77 | #include 78 | 79 | #endif /* _dhd_dbg_ */ 80 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/dhd_gpio.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Customer code to add GPIO control during WLAN start/stop 3 | * Copyright (C) 1999-2011, Broadcom Corporation 4 | * 5 | * Unless you and Broadcom execute a separate written software license 6 | * agreement governing use of this software, this software is licensed to you 7 | * under the terms of the GNU General Public License version 2 (the "GPL"), 8 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 9 | * following added to such license: 10 | * 11 | * As a special exception, the copyright holders of this software give you 12 | * permission to link this software with independent modules, and to copy and 13 | * distribute the resulting executable under terms of your choice, provided that 14 | * you also meet, for each linked independent module, the terms and conditions of 15 | * the license of that module. An independent module is a module which is not 16 | * derived from this software. The special exception does not apply to any 17 | * modifications of the software. 18 | * 19 | * Notwithstanding the above, under no circumstances may you combine this 20 | * software in any way with any other Broadcom software provided under a license 21 | * other than the GPL, without Broadcom's express prior written consent. 22 | * 23 | * $Id: dhd_custom_gpio.c,v 1.2.42.1 2010-10-19 00:41:09 Exp $ 24 | */ 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | #ifdef CUSTOMER_HW 32 | 33 | extern int __gpio_to_irq(unsigned gpio); 34 | extern int gpio_direction_input(unsigned gpio); 35 | extern int gpio_request(unsigned gpio, const char *label); 36 | extern void gpio_free(unsigned gpio); 37 | 38 | #ifdef CUSTOMER_OOB 39 | extern int wl_host_wake_irqno; 40 | int bcm_wlan_get_oob_irq(void) 41 | { 42 | return wl_host_wake_irqno; 43 | } 44 | #endif 45 | 46 | 47 | #endif /* CUSTOMER_HW */ 48 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/dhd_ip.c: -------------------------------------------------------------------------------- 1 | /* 2 | * IP Packet Parser Module. 3 | * 4 | * Copyright (C) 1999-2013, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id$ 25 | */ 26 | #include 27 | #include 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | #include 36 | 37 | #include 38 | 39 | /* special values */ 40 | /* 802.3 llc/snap header */ 41 | static const uint8 llc_snap_hdr[SNAP_HDR_LEN] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00}; 42 | 43 | pkt_frag_t pkt_frag_info(osl_t *osh, void *p) 44 | { 45 | uint8 *frame; 46 | int length; 47 | uint8 *pt; /* Pointer to type field */ 48 | uint16 ethertype; 49 | struct ipv4_hdr *iph; /* IP frame pointer */ 50 | int ipl; /* IP frame length */ 51 | uint16 iph_frag; 52 | 53 | ASSERT(osh && p); 54 | 55 | frame = PKTDATA(osh, p); 56 | length = PKTLEN(osh, p); 57 | 58 | /* Process Ethernet II or SNAP-encapsulated 802.3 frames */ 59 | if (length < ETHER_HDR_LEN) { 60 | AP6210_DEBUG("%s: short eth frame (%d)\n", __FUNCTION__, length); 61 | return DHD_PKT_FRAG_NONE; 62 | } else if (ntoh16(*(uint16 *)(frame + ETHER_TYPE_OFFSET)) >= ETHER_TYPE_MIN) { 63 | /* Frame is Ethernet II */ 64 | pt = frame + ETHER_TYPE_OFFSET; 65 | } else if (length >= ETHER_HDR_LEN + SNAP_HDR_LEN + ETHER_TYPE_LEN && 66 | !bcmp(llc_snap_hdr, frame + ETHER_HDR_LEN, SNAP_HDR_LEN)) { 67 | pt = frame + ETHER_HDR_LEN + SNAP_HDR_LEN; 68 | } else { 69 | AP6210_DEBUG("%s: non-SNAP 802.3 frame\n", __FUNCTION__); 70 | return DHD_PKT_FRAG_NONE; 71 | } 72 | 73 | ethertype = ntoh16(*(uint16 *)pt); 74 | 75 | /* Skip VLAN tag, if any */ 76 | if (ethertype == ETHER_TYPE_8021Q) { 77 | pt += VLAN_TAG_LEN; 78 | 79 | if (pt + ETHER_TYPE_LEN > frame + length) { 80 | AP6210_DEBUG("%s: short VLAN frame (%d)\n", __FUNCTION__, length); 81 | return DHD_PKT_FRAG_NONE; 82 | } 83 | 84 | ethertype = ntoh16(*(uint16 *)pt); 85 | } 86 | 87 | if (ethertype != ETHER_TYPE_IP) { 88 | AP6210_DEBUG("%s: non-IP frame (ethertype 0x%x, length %d)\n", 89 | __FUNCTION__, ethertype, length); 90 | return DHD_PKT_FRAG_NONE; 91 | } 92 | 93 | iph = (struct ipv4_hdr *)(pt + ETHER_TYPE_LEN); 94 | ipl = length - (pt + ETHER_TYPE_LEN - frame); 95 | 96 | /* We support IPv4 only */ 97 | if ((ipl < IPV4_OPTIONS_OFFSET) || (IP_VER(iph) != IP_VER_4)) { 98 | AP6210_DEBUG("%s: short frame (%d) or non-IPv4\n", __FUNCTION__, ipl); 99 | return DHD_PKT_FRAG_NONE; 100 | } 101 | 102 | iph_frag = ntoh16(iph->frag); 103 | 104 | if (iph_frag & IPV4_FRAG_DONT) { 105 | return DHD_PKT_FRAG_NONE; 106 | } else if ((iph_frag & IPV4_FRAG_MORE) == 0) { 107 | return DHD_PKT_FRAG_LAST; 108 | } else { 109 | return (iph_frag & IPV4_FRAG_OFFSET_MASK)? DHD_PKT_FRAG_CONT : DHD_PKT_FRAG_FIRST; 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/dhd_ip.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Header file describing the common ip parser function. 3 | * 4 | * Provides type definitions and function prototypes used to parse ip packet. 5 | * 6 | * Copyright (C) 1999-2013, Broadcom Corporation 7 | * 8 | * Unless you and Broadcom execute a separate written software license 9 | * agreement governing use of this software, this software is licensed to you 10 | * under the terms of the GNU General Public License version 2 (the "GPL"), 11 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 12 | * following added to such license: 13 | * 14 | * As a special exception, the copyright holders of this software give you 15 | * permission to link this software with independent modules, and to copy and 16 | * distribute the resulting executable under terms of your choice, provided that 17 | * you also meet, for each linked independent module, the terms and conditions of 18 | * the license of that module. An independent module is a module which is not 19 | * derived from this software. The special exception does not apply to any 20 | * modifications of the software. 21 | * 22 | * Notwithstanding the above, under no circumstances may you combine this 23 | * software in any way with any other Broadcom software provided under a license 24 | * other than the GPL, without Broadcom's express prior written consent. 25 | * 26 | * $Id$ 27 | */ 28 | 29 | #ifndef _dhd_ip_h_ 30 | #define _dhd_ip_h_ 31 | 32 | typedef enum pkt_frag 33 | { 34 | DHD_PKT_FRAG_NONE = 0, 35 | DHD_PKT_FRAG_FIRST, 36 | DHD_PKT_FRAG_CONT, 37 | DHD_PKT_FRAG_LAST 38 | } pkt_frag_t; 39 | 40 | extern pkt_frag_t pkt_frag_info(osl_t *osh, void *p); 41 | 42 | #endif /* _dhd_ip_h_ */ 43 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/dhd_linux_sched.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Expose some of the kernel scheduler routines 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: dhd_linux_sched.c 291086 2011-10-21 01:17:24Z $ 25 | */ 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | int setScheduler(struct task_struct *p, int policy, struct sched_param *param) 33 | { 34 | int rc = 0; 35 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) 36 | rc = sched_setscheduler(p, policy, param); 37 | #endif /* LinuxVer */ 38 | return rc; 39 | } 40 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/dhd_pno.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Header file of Broadcom Dongle Host Driver (DHD) 3 | * Prefered Network Offload code and Wi-Fi Location Service(WLS) code. 4 | * Copyright (C) 1999-2013, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: dhd_pno.h 419969 2013-08-23 18:54:36Z $ 25 | */ 26 | 27 | #ifndef __DHD_PNO_H__ 28 | #define __DHD_PNO_H__ 29 | 30 | #define PNO_TLV_PREFIX 'S' 31 | #define PNO_TLV_VERSION '1' 32 | #define PNO_TLV_SUBTYPE_LEGACY_PNO '2' 33 | #define PNO_TLV_RESERVED '0' 34 | 35 | #define PNO_BATCHING_SET "SET" 36 | #define PNO_BATCHING_GET "GET" 37 | #define PNO_BATCHING_STOP "STOP" 38 | 39 | #define PNO_PARAMS_DELIMETER " " 40 | #define PNO_PARAM_CHANNEL_DELIMETER "," 41 | #define PNO_PARAM_VALUE_DELLIMETER '=' 42 | #define PNO_PARAM_SCANFREQ "SCANFREQ" 43 | #define PNO_PARAM_BESTN "BESTN" 44 | #define PNO_PARAM_MSCAN "MSCAN" 45 | #define PNO_PARAM_CHANNEL "CHANNEL" 46 | #define PNO_PARAM_RTT "RTT" 47 | 48 | #define PNO_TLV_TYPE_SSID_IE 'S' 49 | #define PNO_TLV_TYPE_TIME 'T' 50 | #define PNO_TLV_FREQ_REPEAT 'R' 51 | #define PNO_TLV_FREQ_EXPO_MAX 'M' 52 | 53 | #define MAXNUM_SSID_PER_ADD 16 54 | #define MAXNUM_PNO_PARAMS 2 55 | #define PNO_TLV_COMMON_LENGTH 1 56 | #define DEFAULT_BATCH_MSCAN 16 57 | 58 | #define RESULTS_END_MARKER "----\n" 59 | #define SCAN_END_MARKER "####\n" 60 | #define AP_END_MARKER "====\n" 61 | 62 | enum scan_status { 63 | /* SCAN ABORT by other scan */ 64 | PNO_STATUS_ABORT, 65 | /* RTT is presence or not */ 66 | PNO_STATUS_RTT_PRESENCE, 67 | /* Disable PNO by Driver */ 68 | PNO_STATUS_DISABLE, 69 | /* NORMAL BATCHING GET */ 70 | PNO_STATUS_NORMAL, 71 | /* WLC_E_PFN_BEST_BATCHING */ 72 | PNO_STATUS_EVENT, 73 | PNO_STATUS_MAX 74 | }; 75 | #define PNO_STATUS_ABORT_MASK 0x0001 76 | #define PNO_STATUS_RTT_MASK 0x0002 77 | #define PNO_STATUS_DISABLE_MASK 0x0004 78 | #define PNO_STATUS_OOM_MASK 0x0010 79 | 80 | enum index_mode { 81 | INDEX_OF_LEGACY_PARAMS, 82 | INDEX_OF_BATCH_PARAMS, 83 | INDEX_OF_HOTLIST_PARAMS, 84 | INDEX_MODE_MAX 85 | }; 86 | enum dhd_pno_status { 87 | DHD_PNO_DISABLED, 88 | DHD_PNO_ENABLED, 89 | DHD_PNO_SUSPEND 90 | }; 91 | typedef struct cmd_tlv { 92 | char prefix; 93 | char version; 94 | char subtype; 95 | char reserved; 96 | } cmd_tlv_t; 97 | typedef enum dhd_pno_mode { 98 | /* Wi-Fi Legacy PNO Mode */ 99 | DHD_PNO_NONE_MODE = 0, 100 | DHD_PNO_LEGACY_MODE = (1 << (0)), 101 | /* Wi-Fi Android BATCH SCAN Mode */ 102 | DHD_PNO_BATCH_MODE = (1 << (1)), 103 | /* Wi-Fi Android Hotlist SCAN Mode */ 104 | DHD_PNO_HOTLIST_MODE = (1 << (2)) 105 | } dhd_pno_mode_t; 106 | struct dhd_pno_ssid { 107 | uint32 SSID_len; 108 | uchar SSID[DOT11_MAX_SSID_LEN]; 109 | struct list_head list; 110 | }; 111 | struct dhd_pno_bssid { 112 | struct ether_addr macaddr; 113 | /* Bit4: suppress_lost, Bit3: suppress_found */ 114 | uint16 flags; 115 | struct list_head list; 116 | }; 117 | typedef struct dhd_pno_bestnet_entry { 118 | struct ether_addr BSSID; 119 | uint8 SSID_len; 120 | uint8 SSID[DOT11_MAX_SSID_LEN]; 121 | int8 RSSI; 122 | uint8 channel; 123 | uint32 timestamp; 124 | uint16 rtt0; /* distance_cm based on RTT */ 125 | uint16 rtt1; /* distance_cm based on sample standard deviation */ 126 | unsigned long recorded_time; 127 | struct list_head list; 128 | } dhd_pno_bestnet_entry_t; 129 | #define BESTNET_ENTRY_SIZE (sizeof(dhd_pno_bestnet_entry_t)) 130 | 131 | typedef struct dhd_pno_bestnet_header { 132 | struct dhd_pno_bestnet_header *next; 133 | uint8 reason; 134 | uint32 tot_cnt; 135 | uint32 tot_size; 136 | struct list_head entry_list; 137 | } dhd_pno_best_header_t; 138 | #define BEST_HEADER_SIZE (sizeof(dhd_pno_best_header_t)) 139 | 140 | typedef struct dhd_pno_scan_results { 141 | dhd_pno_best_header_t *bestnetheader; 142 | uint8 cnt_header; 143 | struct list_head list; 144 | } dhd_pno_scan_results_t; 145 | #define SCAN_RESULTS_SIZE (sizeof(dhd_pno_scan_results_t)) 146 | 147 | struct dhd_pno_get_batch_info { 148 | /* info related to get batch */ 149 | char *buf; 150 | bool batch_started; 151 | uint32 tot_scan_cnt; 152 | uint32 expired_tot_scan_cnt; 153 | uint32 top_node_cnt; 154 | uint32 bufsize; 155 | int reason; 156 | struct list_head scan_results_list; 157 | struct list_head expired_scan_results_list; 158 | }; 159 | struct dhd_pno_legacy_params { 160 | uint16 scan_fr; 161 | uint16 chan_list[WL_NUMCHANNELS]; 162 | uint16 nchan; 163 | int pno_repeat; 164 | int pno_freq_expo_max; 165 | int nssid; 166 | struct list_head ssid_list; 167 | }; 168 | struct dhd_pno_batch_params { 169 | int32 scan_fr; 170 | uint8 bestn; 171 | uint8 mscan; 172 | uint8 band; 173 | uint16 chan_list[WL_NUMCHANNELS]; 174 | uint16 nchan; 175 | uint16 rtt; 176 | struct dhd_pno_get_batch_info get_batch; 177 | }; 178 | struct dhd_pno_hotlist_params { 179 | uint8 band; 180 | int32 scan_fr; 181 | uint16 chan_list[WL_NUMCHANNELS]; 182 | uint16 nchan; 183 | uint16 nbssid; 184 | struct list_head bssid_list; 185 | }; 186 | typedef union dhd_pno_params { 187 | struct dhd_pno_legacy_params params_legacy; 188 | struct dhd_pno_batch_params params_batch; 189 | struct dhd_pno_hotlist_params params_hotlist; 190 | } dhd_pno_params_t; 191 | typedef struct dhd_pno_status_info { 192 | dhd_pub_t *dhd; 193 | struct work_struct work; 194 | struct mutex pno_mutex; 195 | struct completion get_batch_done; 196 | bool wls_supported; /* wifi location service supported or not */ 197 | enum dhd_pno_status pno_status; 198 | enum dhd_pno_mode pno_mode; 199 | dhd_pno_params_t pno_params_arr[INDEX_MODE_MAX]; 200 | struct list_head head_list; 201 | } dhd_pno_status_info_t; 202 | 203 | /* wrapper functions */ 204 | extern int 205 | dhd_dev_pno_enable(struct net_device *dev, int enable); 206 | 207 | extern int 208 | dhd_dev_pno_stop_for_ssid(struct net_device *dev); 209 | 210 | extern int 211 | dhd_dev_pno_set_for_ssid(struct net_device *dev, wlc_ssid_t* ssids_local, int nssid, 212 | uint16 scan_fr, int pno_repeat, int pno_freq_expo_max, uint16 *channel_list, int nchan); 213 | 214 | extern int 215 | dhd_dev_pno_set_for_batch(struct net_device *dev, 216 | struct dhd_pno_batch_params *batch_params); 217 | 218 | extern int 219 | dhd_dev_pno_get_for_batch(struct net_device *dev, char *buf, int bufsize); 220 | 221 | extern int 222 | dhd_dev_pno_stop_for_batch(struct net_device *dev); 223 | 224 | extern int 225 | dhd_dev_pno_set_for_hotlist(struct net_device *dev, wl_pfn_bssid_t *p_pfn_bssid, 226 | struct dhd_pno_hotlist_params *hotlist_params); 227 | 228 | /* dhd pno fuctions */ 229 | extern int dhd_pno_stop_for_ssid(dhd_pub_t *dhd); 230 | extern int dhd_pno_enable(dhd_pub_t *dhd, int enable); 231 | extern int dhd_pno_set_for_ssid(dhd_pub_t *dhd, wlc_ssid_t* ssid_list, int nssid, 232 | uint16 scan_fr, int pno_repeat, int pno_freq_expo_max, uint16 *channel_list, int nchan); 233 | 234 | extern int dhd_pno_set_for_batch(dhd_pub_t *dhd, struct dhd_pno_batch_params *batch_params); 235 | 236 | extern int dhd_pno_get_for_batch(dhd_pub_t *dhd, char *buf, int bufsize, int reason); 237 | 238 | 239 | extern int dhd_pno_stop_for_batch(dhd_pub_t *dhd); 240 | 241 | extern int dhd_pno_set_for_hotlist(dhd_pub_t *dhd, wl_pfn_bssid_t *p_pfn_bssid, 242 | struct dhd_pno_hotlist_params *hotlist_params); 243 | 244 | extern int dhd_pno_stop_for_hotlist(dhd_pub_t *dhd); 245 | 246 | extern int dhd_pno_event_handler(dhd_pub_t *dhd, wl_event_msg_t *event, void *event_data); 247 | extern int dhd_pno_init(dhd_pub_t *dhd); 248 | extern int dhd_pno_deinit(dhd_pub_t *dhd); 249 | #endif /* __DHD_PNO_H__ */ 250 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/dhd_proto.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Header file describing the internal (inter-module) DHD interfaces. 3 | * 4 | * Provides type definitions and function prototypes used to link the 5 | * DHD OS, bus, and protocol modules. 6 | * 7 | * Copyright (C) 1999-2012, Broadcom Corporation 8 | * 9 | * Unless you and Broadcom execute a separate written software license 10 | * agreement governing use of this software, this software is licensed to you 11 | * under the terms of the GNU General Public License version 2 (the "GPL"), 12 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 13 | * following added to such license: 14 | * 15 | * As a special exception, the copyright holders of this software give you 16 | * permission to link this software with independent modules, and to copy and 17 | * distribute the resulting executable under terms of your choice, provided that 18 | * you also meet, for each linked independent module, the terms and conditions of 19 | * the license of that module. An independent module is a module which is not 20 | * derived from this software. The special exception does not apply to any 21 | * modifications of the software. 22 | * 23 | * Notwithstanding the above, under no circumstances may you combine this 24 | * software in any way with any other Broadcom software provided under a license 25 | * other than the GPL, without Broadcom's express prior written consent. 26 | * 27 | * $Id: dhd_proto.h 343390 2012-07-06 22:34:19Z $ 28 | */ 29 | 30 | #ifndef _dhd_proto_h_ 31 | #define _dhd_proto_h_ 32 | 33 | #include 34 | #include 35 | 36 | #ifndef IOCTL_RESP_TIMEOUT 37 | #define IOCTL_RESP_TIMEOUT 2000 /* In milli second default value for Production FW */ 38 | #endif /* IOCTL_RESP_TIMEOUT */ 39 | 40 | /* 41 | * Exported from the dhd protocol module (dhd_cdc, dhd_rndis) 42 | */ 43 | 44 | /* Linkage, sets prot link and updates hdrlen in pub */ 45 | extern int dhd_prot_attach(dhd_pub_t *dhdp); 46 | 47 | /* Unlink, frees allocated protocol memory (including dhd_prot) */ 48 | extern void dhd_prot_detach(dhd_pub_t *dhdp); 49 | 50 | /* Initialize protocol: sync w/dongle state. 51 | * Sets dongle media info (iswl, drv_version, mac address). 52 | */ 53 | extern int dhd_prot_init(dhd_pub_t *dhdp); 54 | 55 | /* Stop protocol: sync w/dongle state. */ 56 | extern void dhd_prot_stop(dhd_pub_t *dhdp); 57 | #ifdef PROP_TXSTATUS 58 | extern int dhd_wlfc_init(dhd_pub_t *dhd); 59 | extern void dhd_wlfc_deinit(dhd_pub_t *dhd); 60 | #endif /* PROP_TXSTATUS */ 61 | 62 | /* Add any protocol-specific data header. 63 | * Caller must reserve prot_hdrlen prepend space. 64 | */ 65 | extern void dhd_prot_hdrpush(dhd_pub_t *, int ifidx, void *txp); 66 | 67 | /* Remove any protocol-specific data header. */ 68 | extern int dhd_prot_hdrpull(dhd_pub_t *, int *ifidx, void *rxp, uchar *buf, uint *len); 69 | 70 | /* Use protocol to issue ioctl to dongle */ 71 | extern int dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t * ioc, void * buf, int len); 72 | 73 | /* Handles a protocol control response asynchronously */ 74 | extern int dhd_prot_ctl_complete(dhd_pub_t *dhd); 75 | 76 | /* Check for and handle local prot-specific iovar commands */ 77 | extern int dhd_prot_iovar_op(dhd_pub_t *dhdp, const char *name, 78 | void *params, int plen, void *arg, int len, bool set); 79 | 80 | /* Add prot dump output to a buffer */ 81 | extern void dhd_prot_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf); 82 | 83 | /* Update local copy of dongle statistics */ 84 | extern void dhd_prot_dstats(dhd_pub_t *dhdp); 85 | 86 | extern int dhd_ioctl(dhd_pub_t * dhd_pub, dhd_ioctl_t *ioc, void * buf, uint buflen); 87 | 88 | extern int dhd_preinit_ioctls(dhd_pub_t *dhd); 89 | 90 | #ifdef PROP_TXSTATUS 91 | extern int dhd_wlfc_enque_sendq(void* state, int prec, void* p); 92 | extern int dhd_wlfc_commit_packets(void* state, f_commitpkt_t fcommit, void* commit_ctx); 93 | extern void dhd_wlfc_cleanup(dhd_pub_t *dhd); 94 | #endif /* PROP_TXSTATUS */ 95 | 96 | extern int dhd_process_pkt_reorder_info(dhd_pub_t *dhd, uchar *reorder_info_buf, 97 | uint reorder_info_len, void **pkt, uint32 *free_buf_count); 98 | 99 | 100 | /******************************** 101 | * For version-string expansion * 102 | */ 103 | #if defined(BDC) 104 | #define DHD_PROTOCOL "bdc" 105 | #elif defined(CDC) 106 | #define DHD_PROTOCOL "cdc" 107 | #elif defined(RNDIS) 108 | #define DHD_PROTOCOL "rndis" 109 | #else 110 | #define DHD_PROTOCOL "unknown" 111 | #endif /* proto */ 112 | 113 | #endif /* _dhd_proto_h_ */ 114 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/dngl_stats.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Common stats definitions for clients of dongle 3 | * ports 4 | * 5 | * Copyright (C) 1999-2012, Broadcom Corporation 6 | * 7 | * Unless you and Broadcom execute a separate written software license 8 | * agreement governing use of this software, this software is licensed to you 9 | * under the terms of the GNU General Public License version 2 (the "GPL"), 10 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 11 | * following added to such license: 12 | * 13 | * As a special exception, the copyright holders of this software give you 14 | * permission to link this software with independent modules, and to copy and 15 | * distribute the resulting executable under terms of your choice, provided that 16 | * you also meet, for each linked independent module, the terms and conditions of 17 | * the license of that module. An independent module is a module which is not 18 | * derived from this software. The special exception does not apply to any 19 | * modifications of the software. 20 | * 21 | * Notwithstanding the above, under no circumstances may you combine this 22 | * software in any way with any other Broadcom software provided under a license 23 | * other than the GPL, without Broadcom's express prior written consent. 24 | * 25 | * $Id: dngl_stats.h 241182 2011-02-17 21:50:03Z $ 26 | */ 27 | 28 | #ifndef _dngl_stats_h_ 29 | #define _dngl_stats_h_ 30 | 31 | typedef struct { 32 | unsigned long rx_packets; /* total packets received */ 33 | unsigned long tx_packets; /* total packets transmitted */ 34 | unsigned long rx_bytes; /* total bytes received */ 35 | unsigned long tx_bytes; /* total bytes transmitted */ 36 | unsigned long rx_errors; /* bad packets received */ 37 | unsigned long tx_errors; /* packet transmit problems */ 38 | unsigned long rx_dropped; /* packets dropped by dongle */ 39 | unsigned long tx_dropped; /* packets dropped by dongle */ 40 | unsigned long multicast; /* multicast packets received */ 41 | } dngl_stats_t; 42 | 43 | #endif /* _dngl_stats_h_ */ 44 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/dngl_wlhdr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Dongle WL Header definitions 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: dngl_wlhdr.h 241182 2011-02-17 21:50:03Z $ 25 | */ 26 | 27 | #ifndef _dngl_wlhdr_h_ 28 | #define _dngl_wlhdr_h_ 29 | 30 | typedef struct wl_header { 31 | uint8 type; /* Header type */ 32 | uint8 version; /* Header version */ 33 | int8 rssi; /* RSSI */ 34 | uint8 pad; /* Unused */ 35 | } wl_header_t; 36 | 37 | #define WL_HEADER_LEN sizeof(wl_header_t) 38 | #define WL_HEADER_TYPE 0 39 | #define WL_HEADER_VER 1 40 | #endif /* _dngl_wlhdr_h_ */ 41 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/hndpmu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Misc utility routines for accessing PMU corerev specific features 3 | * of the SiliconBackplane-based Broadcom chips. 4 | * 5 | * Copyright (C) 1999-2012, Broadcom Corporation 6 | * 7 | * Unless you and Broadcom execute a separate written software license 8 | * agreement governing use of this software, this software is licensed to you 9 | * under the terms of the GNU General Public License version 2 (the "GPL"), 10 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 11 | * following added to such license: 12 | * 13 | * As a special exception, the copyright holders of this software give you 14 | * permission to link this software with independent modules, and to copy and 15 | * distribute the resulting executable under terms of your choice, provided that 16 | * you also meet, for each linked independent module, the terms and conditions of 17 | * the license of that module. An independent module is a module which is not 18 | * derived from this software. The special exception does not apply to any 19 | * modifications of the software. 20 | * 21 | * Notwithstanding the above, under no circumstances may you combine this 22 | * software in any way with any other Broadcom software provided under a license 23 | * other than the GPL, without Broadcom's express prior written consent. 24 | * 25 | * $Id: hndpmu.c 354194 2012-08-30 08:39:03Z $ 26 | */ 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | #define PMU_ERROR(args) 40 | 41 | #define PMU_MSG(args) 42 | 43 | /* To check in verbose debugging messages not intended 44 | * to be on except on private builds. 45 | */ 46 | #define PMU_NONE(args) 47 | 48 | 49 | /* SDIO Pad drive strength to select value mappings. 50 | * The last strength value in each table must be 0 (the tri-state value). 51 | */ 52 | typedef struct { 53 | uint8 strength; /* Pad Drive Strength in mA */ 54 | uint8 sel; /* Chip-specific select value */ 55 | } sdiod_drive_str_t; 56 | 57 | /* SDIO Drive Strength to sel value table for PMU Rev 1 */ 58 | static const sdiod_drive_str_t sdiod_drive_strength_tab1[] = { 59 | {4, 0x2}, 60 | {2, 0x3}, 61 | {1, 0x0}, 62 | {0, 0x0} }; 63 | 64 | /* SDIO Drive Strength to sel value table for PMU Rev 2, 3 */ 65 | static const sdiod_drive_str_t sdiod_drive_strength_tab2[] = { 66 | {12, 0x7}, 67 | {10, 0x6}, 68 | {8, 0x5}, 69 | {6, 0x4}, 70 | {4, 0x2}, 71 | {2, 0x1}, 72 | {0, 0x0} }; 73 | 74 | /* SDIO Drive Strength to sel value table for PMU Rev 8 (1.8V) */ 75 | static const sdiod_drive_str_t sdiod_drive_strength_tab3[] = { 76 | {32, 0x7}, 77 | {26, 0x6}, 78 | {22, 0x5}, 79 | {16, 0x4}, 80 | {12, 0x3}, 81 | {8, 0x2}, 82 | {4, 0x1}, 83 | {0, 0x0} }; 84 | 85 | /* SDIO Drive Strength to sel value table for PMU Rev 11 (1.8v) */ 86 | static const sdiod_drive_str_t sdiod_drive_strength_tab4_1v8[] = { 87 | {32, 0x6}, 88 | {26, 0x7}, 89 | {22, 0x4}, 90 | {16, 0x5}, 91 | {12, 0x2}, 92 | {8, 0x3}, 93 | {4, 0x0}, 94 | {0, 0x1} }; 95 | 96 | /* SDIO Drive Strength to sel value table for PMU Rev 11 (1.2v) */ 97 | 98 | /* SDIO Drive Strength to sel value table for PMU Rev 11 (2.5v) */ 99 | 100 | /* SDIO Drive Strength to sel value table for PMU Rev 13 (1.8v) */ 101 | static const sdiod_drive_str_t sdiod_drive_strength_tab5_1v8[] = { 102 | {6, 0x7}, 103 | {5, 0x6}, 104 | {4, 0x5}, 105 | {3, 0x4}, 106 | {2, 0x2}, 107 | {1, 0x1}, 108 | {0, 0x0} }; 109 | 110 | /* SDIO Drive Strength to sel value table for PMU Rev 13 (3.3v) */ 111 | 112 | /* SDIO Drive Strength to sel value table for PMU Rev 17 (1.8v) */ 113 | static const sdiod_drive_str_t sdiod_drive_strength_tab6_1v8[] = { 114 | {3, 0x3}, 115 | {2, 0x2}, 116 | {1, 0x1}, 117 | {0, 0x0} }; 118 | 119 | #define SDIOD_DRVSTR_KEY(chip, pmu) (((chip) << 16) | (pmu)) 120 | 121 | void 122 | si_sdiod_drive_strength_init(si_t *sih, osl_t *osh, uint32 drivestrength) 123 | { 124 | chipcregs_t *cc; 125 | uint origidx, intr_val = 0; 126 | sdiod_drive_str_t *str_tab = NULL; 127 | uint32 str_mask = 0; 128 | uint32 str_shift = 0; 129 | 130 | if (!(sih->cccaps & CC_CAP_PMU)) { 131 | return; 132 | } 133 | 134 | /* Remember original core before switch to chipc */ 135 | cc = (chipcregs_t *) si_switch_core(sih, CC_CORE_ID, &origidx, &intr_val); 136 | 137 | switch (SDIOD_DRVSTR_KEY(sih->chip, sih->pmurev)) { 138 | case SDIOD_DRVSTR_KEY(BCM4325_CHIP_ID, 1): 139 | str_tab = (sdiod_drive_str_t *)&sdiod_drive_strength_tab1; 140 | str_mask = 0x30000000; 141 | str_shift = 28; 142 | break; 143 | case SDIOD_DRVSTR_KEY(BCM4325_CHIP_ID, 2): 144 | case SDIOD_DRVSTR_KEY(BCM4325_CHIP_ID, 3): 145 | case SDIOD_DRVSTR_KEY(BCM4315_CHIP_ID, 4): 146 | str_tab = (sdiod_drive_str_t *)&sdiod_drive_strength_tab2; 147 | str_mask = 0x00003800; 148 | str_shift = 11; 149 | break; 150 | case SDIOD_DRVSTR_KEY(BCM4336_CHIP_ID, 8): 151 | case SDIOD_DRVSTR_KEY(BCM4336_CHIP_ID, 11): 152 | if (sih->pmurev == 8) { 153 | str_tab = (sdiod_drive_str_t *)&sdiod_drive_strength_tab3; 154 | } 155 | else if (sih->pmurev == 11) { 156 | str_tab = (sdiod_drive_str_t *)&sdiod_drive_strength_tab4_1v8; 157 | } 158 | str_mask = 0x00003800; 159 | str_shift = 11; 160 | break; 161 | case SDIOD_DRVSTR_KEY(BCM4330_CHIP_ID, 12): 162 | str_tab = (sdiod_drive_str_t *)&sdiod_drive_strength_tab4_1v8; 163 | str_mask = 0x00003800; 164 | str_shift = 11; 165 | break; 166 | case SDIOD_DRVSTR_KEY(BCM43362_CHIP_ID, 13): 167 | str_tab = (sdiod_drive_str_t *)&sdiod_drive_strength_tab5_1v8; 168 | str_mask = 0x00003800; 169 | str_shift = 11; 170 | break; 171 | case SDIOD_DRVSTR_KEY(BCM4334_CHIP_ID, 17): 172 | str_tab = (sdiod_drive_str_t *)&sdiod_drive_strength_tab6_1v8; 173 | str_mask = 0x00001800; 174 | str_shift = 11; 175 | break; 176 | default: 177 | PMU_MSG(("No SDIO Drive strength init done for chip %s rev %d pmurev %d\n", 178 | bcm_chipname(sih->chip, chn, 8), sih->chiprev, sih->pmurev)); 179 | 180 | break; 181 | } 182 | 183 | if (str_tab != NULL && cc != NULL) { 184 | uint32 cc_data_temp; 185 | int i; 186 | 187 | /* Pick the lowest available drive strength equal or greater than the 188 | * requested strength. Drive strength of 0 requests tri-state. 189 | */ 190 | for (i = 0; drivestrength < str_tab[i].strength; i++) 191 | ; 192 | 193 | if (i > 0 && drivestrength > str_tab[i].strength) 194 | i--; 195 | 196 | W_REG(osh, &cc->chipcontrol_addr, 1); 197 | cc_data_temp = R_REG(osh, &cc->chipcontrol_data); 198 | cc_data_temp &= ~str_mask; 199 | cc_data_temp |= str_tab[i].sel << str_shift; 200 | W_REG(osh, &cc->chipcontrol_data, cc_data_temp); 201 | 202 | PMU_MSG(("SDIO: %dmA drive strength requested; set to %dmA\n", 203 | drivestrength, str_tab[i].strength)); 204 | } 205 | 206 | /* Return to original core */ 207 | si_restore_core(sih, origidx, intr_val); 208 | } 209 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/Makefile: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # This script serves following purpose: 4 | # 5 | # 1. It generates native version information by querying 6 | # automerger maintained database to see where src/include 7 | # came from 8 | # 2. For select components, as listed in compvers.sh 9 | # it generates component version files 10 | # 11 | # Copyright 2005, Broadcom, Inc. 12 | # 13 | # $Id: Makefile 241686 2011-02-19 00:22:45Z prakashd $ 14 | # 15 | 16 | SRCBASE := .. 17 | 18 | TARGETS := epivers.h 19 | 20 | ifdef VERBOSE 21 | export VERBOSE 22 | endif 23 | 24 | all release: epivers compvers 25 | 26 | # Generate epivers.h for native branch version 27 | epivers: 28 | bash epivers.sh 29 | 30 | # Generate epivers.h for native branch version 31 | compvers: 32 | @if [ -s "compvers.sh" ]; then \ 33 | echo "Generating component versions, if any"; \ 34 | bash compvers.sh; \ 35 | else \ 36 | echo "Skipping component version generation"; \ 37 | fi 38 | 39 | # Generate epivers.h for native branch version 40 | clean_compvers: 41 | @if [ -s "compvers.sh" ]; then \ 42 | echo "bash compvers.sh clean"; \ 43 | bash compvers.sh clean; \ 44 | else \ 45 | echo "Skipping component version clean"; \ 46 | fi 47 | 48 | clean: 49 | rm -f $(TARGETS) *.prev 50 | 51 | clean_all: clean clean_compvers 52 | 53 | .PHONY: all release clean epivers compvers clean_compvers 54 | 55 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/bcm_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * BCM common config options 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: bcm_cfg.h 294399 2011-11-07 03:31:22Z $ 25 | */ 26 | 27 | #ifndef _bcm_cfg_h_ 28 | #define _bcm_cfg_h_ 29 | #endif /* _bcm_cfg_h_ */ 30 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/bcmcdc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CDC network driver ioctl/indication encoding 3 | * Broadcom 802.11abg Networking Device Driver 4 | * 5 | * Definitions subject to change without notice. 6 | * 7 | * Copyright (C) 1999-2012, Broadcom Corporation 8 | * 9 | * Unless you and Broadcom execute a separate written software license 10 | * agreement governing use of this software, this software is licensed to you 11 | * under the terms of the GNU General Public License version 2 (the "GPL"), 12 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 13 | * following added to such license: 14 | * 15 | * As a special exception, the copyright holders of this software give you 16 | * permission to link this software with independent modules, and to copy and 17 | * distribute the resulting executable under terms of your choice, provided that 18 | * you also meet, for each linked independent module, the terms and conditions of 19 | * the license of that module. An independent module is a module which is not 20 | * derived from this software. The special exception does not apply to any 21 | * modifications of the software. 22 | * 23 | * Notwithstanding the above, under no circumstances may you combine this 24 | * software in any way with any other Broadcom software provided under a license 25 | * other than the GPL, without Broadcom's express prior written consent. 26 | * 27 | * $Id: bcmcdc.h 318308 2012-03-02 02:23:42Z $ 28 | */ 29 | #ifndef _bcmcdc_h_ 30 | #define _bcmcdc_h_ 31 | #include 32 | 33 | typedef struct cdc_ioctl { 34 | uint32 cmd; /* ioctl command value */ 35 | uint32 len; /* lower 16: output buflen; upper 16: input buflen (excludes header) */ 36 | uint32 flags; /* flag defns given below */ 37 | uint32 status; /* status code returned from the device */ 38 | } cdc_ioctl_t; 39 | 40 | /* Max valid buffer size that can be sent to the dongle */ 41 | #define CDC_MAX_MSG_SIZE ETHER_MAX_LEN 42 | 43 | /* len field is divided into input and output buffer lengths */ 44 | #define CDCL_IOC_OUTLEN_MASK 0x0000FFFF /* maximum or expected response length, */ 45 | /* excluding IOCTL header */ 46 | #define CDCL_IOC_OUTLEN_SHIFT 0 47 | #define CDCL_IOC_INLEN_MASK 0xFFFF0000 /* input buffer length, excluding IOCTL header */ 48 | #define CDCL_IOC_INLEN_SHIFT 16 49 | 50 | /* CDC flag definitions */ 51 | #define CDCF_IOC_ERROR 0x01 /* 0=success, 1=ioctl cmd failed */ 52 | #define CDCF_IOC_SET 0x02 /* 0=get, 1=set cmd */ 53 | #define CDCF_IOC_OVL_IDX_MASK 0x3c /* overlay region index mask */ 54 | #define CDCF_IOC_OVL_RSV 0x40 /* 1=reserve this overlay region */ 55 | #define CDCF_IOC_OVL 0x80 /* 1=this ioctl corresponds to an overlay */ 56 | #define CDCF_IOC_ACTION_MASK 0xfe /* SET/GET, OVL_IDX, OVL_RSV, OVL mask */ 57 | #define CDCF_IOC_ACTION_SHIFT 1 /* SET/GET, OVL_IDX, OVL_RSV, OVL shift */ 58 | #define CDCF_IOC_IF_MASK 0xF000 /* I/F index */ 59 | #define CDCF_IOC_IF_SHIFT 12 60 | #define CDCF_IOC_ID_MASK 0xFFFF0000 /* used to uniquely id an ioctl req/resp pairing */ 61 | #define CDCF_IOC_ID_SHIFT 16 /* # of bits of shift for ID Mask */ 62 | 63 | #define CDC_IOC_IF_IDX(flags) (((flags) & CDCF_IOC_IF_MASK) >> CDCF_IOC_IF_SHIFT) 64 | #define CDC_IOC_ID(flags) (((flags) & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT) 65 | 66 | #define CDC_GET_IF_IDX(hdr) \ 67 | ((int)((((hdr)->flags) & CDCF_IOC_IF_MASK) >> CDCF_IOC_IF_SHIFT)) 68 | #define CDC_SET_IF_IDX(hdr, idx) \ 69 | ((hdr)->flags = (((hdr)->flags & ~CDCF_IOC_IF_MASK) | ((idx) << CDCF_IOC_IF_SHIFT))) 70 | 71 | /* 72 | * BDC header 73 | * 74 | * The BDC header is used on data packets to convey priority across USB. 75 | */ 76 | 77 | struct bdc_header { 78 | uint8 flags; /* Flags */ 79 | uint8 priority; /* 802.1d Priority 0:2 bits, 4:7 USB flow control info */ 80 | uint8 flags2; 81 | uint8 dataOffset; /* Offset from end of BDC header to packet data, in 82 | * 4-byte words. Leaves room for optional headers. 83 | */ 84 | }; 85 | 86 | #define BDC_HEADER_LEN 4 87 | 88 | /* flags field bitmap */ 89 | #define BDC_FLAG_80211_PKT 0x01 /* Packet is in 802.11 format (dongle -> host) */ 90 | #define BDC_FLAG_SUM_GOOD 0x04 /* Dongle has verified good RX checksums */ 91 | #define BDC_FLAG_SUM_NEEDED 0x08 /* Dongle needs to do TX checksums: host->device */ 92 | #define BDC_FLAG_EVENT_MSG 0x08 /* Payload contains an event msg: device->host */ 93 | #define BDC_FLAG_VER_MASK 0xf0 /* Protocol version mask */ 94 | #define BDC_FLAG_VER_SHIFT 4 /* Protocol version shift */ 95 | 96 | /* priority field bitmap */ 97 | #define BDC_PRIORITY_MASK 0x07 98 | #define BDC_PRIORITY_FC_MASK 0xf0 /* flow control info mask */ 99 | #define BDC_PRIORITY_FC_SHIFT 4 /* flow control info shift */ 100 | 101 | /* flags2 field bitmap */ 102 | #define BDC_FLAG2_IF_MASK 0x0f /* interface index (host <-> dongle) */ 103 | #define BDC_FLAG2_IF_SHIFT 0 104 | #define BDC_FLAG2_FC_FLAG 0x10 /* flag to indicate if pkt contains */ 105 | /* FLOW CONTROL info only */ 106 | 107 | /* version numbers */ 108 | #define BDC_PROTO_VER_1 1 /* Old Protocol version */ 109 | #define BDC_PROTO_VER 2 /* Protocol version */ 110 | 111 | /* flags2.if field access macros */ 112 | #define BDC_GET_IF_IDX(hdr) \ 113 | ((int)((((hdr)->flags2) & BDC_FLAG2_IF_MASK) >> BDC_FLAG2_IF_SHIFT)) 114 | #define BDC_SET_IF_IDX(hdr, idx) \ 115 | ((hdr)->flags2 = (((hdr)->flags2 & ~BDC_FLAG2_IF_MASK) | ((idx) << BDC_FLAG2_IF_SHIFT))) 116 | 117 | #define BDC_FLAG2_PAD_MASK 0xf0 118 | #define BDC_FLAG_PAD_MASK 0x03 119 | #define BDC_FLAG2_PAD_SHIFT 2 120 | #define BDC_FLAG_PAD_SHIFT 0 121 | #define BDC_FLAG2_PAD_IDX 0x3c 122 | #define BDC_FLAG_PAD_IDX 0x03 123 | #define BDC_GET_PAD_LEN(hdr) \ 124 | ((int)(((((hdr)->flags2) & BDC_FLAG2_PAD_MASK) >> BDC_FLAG2_PAD_SHIFT) | \ 125 | ((((hdr)->flags) & BDC_FLAG_PAD_MASK) >> BDC_FLAG_PAD_SHIFT))) 126 | #define BDC_SET_PAD_LEN(hdr, idx) \ 127 | ((hdr)->flags2 = (((hdr)->flags2 & ~BDC_FLAG2_PAD_MASK) | \ 128 | (((idx) & BDC_FLAG2_PAD_IDX) << BDC_FLAG2_PAD_SHIFT))); \ 129 | ((hdr)->flags = (((hdr)->flags & ~BDC_FLAG_PAD_MASK) | \ 130 | (((idx) & BDC_FLAG_PAD_IDX) << BDC_FLAG_PAD_SHIFT))) 131 | 132 | #endif /* _bcmcdc_h_ */ 133 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/bcmendian.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Byte order utilities 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: bcmendian.h 241182 2011-02-17 21:50:03Z $ 25 | * 26 | * This file by default provides proper behavior on little-endian architectures. 27 | * On big-endian architectures, IL_BIGENDIAN should be defined. 28 | */ 29 | 30 | #ifndef _BCMENDIAN_H_ 31 | #define _BCMENDIAN_H_ 32 | 33 | #include 34 | 35 | /* Reverse the bytes in a 16-bit value */ 36 | #define BCMSWAP16(val) \ 37 | ((uint16)((((uint16)(val) & (uint16)0x00ffU) << 8) | \ 38 | (((uint16)(val) & (uint16)0xff00U) >> 8))) 39 | 40 | /* Reverse the bytes in a 32-bit value */ 41 | #define BCMSWAP32(val) \ 42 | ((uint32)((((uint32)(val) & (uint32)0x000000ffU) << 24) | \ 43 | (((uint32)(val) & (uint32)0x0000ff00U) << 8) | \ 44 | (((uint32)(val) & (uint32)0x00ff0000U) >> 8) | \ 45 | (((uint32)(val) & (uint32)0xff000000U) >> 24))) 46 | 47 | /* Reverse the two 16-bit halves of a 32-bit value */ 48 | #define BCMSWAP32BY16(val) \ 49 | ((uint32)((((uint32)(val) & (uint32)0x0000ffffU) << 16) | \ 50 | (((uint32)(val) & (uint32)0xffff0000U) >> 16))) 51 | 52 | /* Byte swapping macros 53 | * Host <=> Network (Big Endian) for 16- and 32-bit values 54 | * Host <=> Little-Endian for 16- and 32-bit values 55 | */ 56 | #ifndef hton16 57 | #define HTON16(i) BCMSWAP16(i) 58 | #define hton16(i) bcmswap16(i) 59 | #define HTON32(i) BCMSWAP32(i) 60 | #define hton32(i) bcmswap32(i) 61 | #define NTOH16(i) BCMSWAP16(i) 62 | #define ntoh16(i) bcmswap16(i) 63 | #define NTOH32(i) BCMSWAP32(i) 64 | #define ntoh32(i) bcmswap32(i) 65 | #define LTOH16(i) (i) 66 | #define ltoh16(i) (i) 67 | #define LTOH32(i) (i) 68 | #define ltoh32(i) (i) 69 | #define HTOL16(i) (i) 70 | #define htol16(i) (i) 71 | #define HTOL32(i) (i) 72 | #define htol32(i) (i) 73 | #endif /* hton16 */ 74 | 75 | #define ltoh16_buf(buf, i) 76 | #define htol16_buf(buf, i) 77 | 78 | /* Unaligned loads and stores in host byte order */ 79 | #define load32_ua(a) ltoh32_ua(a) 80 | #define store32_ua(a, v) htol32_ua_store(v, a) 81 | #define load16_ua(a) ltoh16_ua(a) 82 | #define store16_ua(a, v) htol16_ua_store(v, a) 83 | 84 | #define _LTOH16_UA(cp) ((cp)[0] | ((cp)[1] << 8)) 85 | #define _LTOH32_UA(cp) ((cp)[0] | ((cp)[1] << 8) | ((cp)[2] << 16) | ((cp)[3] << 24)) 86 | #define _NTOH16_UA(cp) (((cp)[0] << 8) | (cp)[1]) 87 | #define _NTOH32_UA(cp) (((cp)[0] << 24) | ((cp)[1] << 16) | ((cp)[2] << 8) | (cp)[3]) 88 | 89 | #define ltoh_ua(ptr) \ 90 | (sizeof(*(ptr)) == sizeof(uint8) ? *(const uint8 *)(ptr) : \ 91 | sizeof(*(ptr)) == sizeof(uint16) ? _LTOH16_UA((const uint8 *)(ptr)) : \ 92 | sizeof(*(ptr)) == sizeof(uint32) ? _LTOH32_UA((const uint8 *)(ptr)) : \ 93 | *(uint8 *)0) 94 | 95 | #define ntoh_ua(ptr) \ 96 | (sizeof(*(ptr)) == sizeof(uint8) ? *(const uint8 *)(ptr) : \ 97 | sizeof(*(ptr)) == sizeof(uint16) ? _NTOH16_UA((const uint8 *)(ptr)) : \ 98 | sizeof(*(ptr)) == sizeof(uint32) ? _NTOH32_UA((const uint8 *)(ptr)) : \ 99 | *(uint8 *)0) 100 | 101 | #ifdef __GNUC__ 102 | 103 | /* GNU macro versions avoid referencing the argument multiple times, while also 104 | * avoiding the -fno-inline used in ROM builds. 105 | */ 106 | 107 | #define bcmswap16(val) ({ \ 108 | uint16 _val = (val); \ 109 | BCMSWAP16(_val); \ 110 | }) 111 | 112 | #define bcmswap32(val) ({ \ 113 | uint32 _val = (val); \ 114 | BCMSWAP32(_val); \ 115 | }) 116 | 117 | #define bcmswap32by16(val) ({ \ 118 | uint32 _val = (val); \ 119 | BCMSWAP32BY16(_val); \ 120 | }) 121 | 122 | #define bcmswap16_buf(buf, len) ({ \ 123 | uint16 *_buf = (uint16 *)(buf); \ 124 | uint _wds = (len) / 2; \ 125 | while (_wds--) { \ 126 | *_buf = bcmswap16(*_buf); \ 127 | _buf++; \ 128 | } \ 129 | }) 130 | 131 | #define htol16_ua_store(val, bytes) ({ \ 132 | uint16 _val = (val); \ 133 | uint8 *_bytes = (uint8 *)(bytes); \ 134 | _bytes[0] = _val & 0xff; \ 135 | _bytes[1] = _val >> 8; \ 136 | }) 137 | 138 | #define htol32_ua_store(val, bytes) ({ \ 139 | uint32 _val = (val); \ 140 | uint8 *_bytes = (uint8 *)(bytes); \ 141 | _bytes[0] = _val & 0xff; \ 142 | _bytes[1] = (_val >> 8) & 0xff; \ 143 | _bytes[2] = (_val >> 16) & 0xff; \ 144 | _bytes[3] = _val >> 24; \ 145 | }) 146 | 147 | #define hton16_ua_store(val, bytes) ({ \ 148 | uint16 _val = (val); \ 149 | uint8 *_bytes = (uint8 *)(bytes); \ 150 | _bytes[0] = _val >> 8; \ 151 | _bytes[1] = _val & 0xff; \ 152 | }) 153 | 154 | #define hton32_ua_store(val, bytes) ({ \ 155 | uint32 _val = (val); \ 156 | uint8 *_bytes = (uint8 *)(bytes); \ 157 | _bytes[0] = _val >> 24; \ 158 | _bytes[1] = (_val >> 16) & 0xff; \ 159 | _bytes[2] = (_val >> 8) & 0xff; \ 160 | _bytes[3] = _val & 0xff; \ 161 | }) 162 | 163 | #define ltoh16_ua(bytes) ({ \ 164 | const uint8 *_bytes = (const uint8 *)(bytes); \ 165 | _LTOH16_UA(_bytes); \ 166 | }) 167 | 168 | #define ltoh32_ua(bytes) ({ \ 169 | const uint8 *_bytes = (const uint8 *)(bytes); \ 170 | _LTOH32_UA(_bytes); \ 171 | }) 172 | 173 | #define ntoh16_ua(bytes) ({ \ 174 | const uint8 *_bytes = (const uint8 *)(bytes); \ 175 | _NTOH16_UA(_bytes); \ 176 | }) 177 | 178 | #define ntoh32_ua(bytes) ({ \ 179 | const uint8 *_bytes = (const uint8 *)(bytes); \ 180 | _NTOH32_UA(_bytes); \ 181 | }) 182 | 183 | #else /* !__GNUC__ */ 184 | 185 | /* Inline versions avoid referencing the argument multiple times */ 186 | static INLINE uint16 187 | bcmswap16(uint16 val) 188 | { 189 | return BCMSWAP16(val); 190 | } 191 | 192 | static INLINE uint32 193 | bcmswap32(uint32 val) 194 | { 195 | return BCMSWAP32(val); 196 | } 197 | 198 | static INLINE uint32 199 | bcmswap32by16(uint32 val) 200 | { 201 | return BCMSWAP32BY16(val); 202 | } 203 | 204 | /* Reverse pairs of bytes in a buffer (not for high-performance use) */ 205 | /* buf - start of buffer of shorts to swap */ 206 | /* len - byte length of buffer */ 207 | static INLINE void 208 | bcmswap16_buf(uint16 *buf, uint len) 209 | { 210 | len = len / 2; 211 | 212 | while (len--) { 213 | *buf = bcmswap16(*buf); 214 | buf++; 215 | } 216 | } 217 | 218 | /* 219 | * Store 16-bit value to unaligned little-endian byte array. 220 | */ 221 | static INLINE void 222 | htol16_ua_store(uint16 val, uint8 *bytes) 223 | { 224 | bytes[0] = val & 0xff; 225 | bytes[1] = val >> 8; 226 | } 227 | 228 | /* 229 | * Store 32-bit value to unaligned little-endian byte array. 230 | */ 231 | static INLINE void 232 | htol32_ua_store(uint32 val, uint8 *bytes) 233 | { 234 | bytes[0] = val & 0xff; 235 | bytes[1] = (val >> 8) & 0xff; 236 | bytes[2] = (val >> 16) & 0xff; 237 | bytes[3] = val >> 24; 238 | } 239 | 240 | /* 241 | * Store 16-bit value to unaligned network-(big-)endian byte array. 242 | */ 243 | static INLINE void 244 | hton16_ua_store(uint16 val, uint8 *bytes) 245 | { 246 | bytes[0] = val >> 8; 247 | bytes[1] = val & 0xff; 248 | } 249 | 250 | /* 251 | * Store 32-bit value to unaligned network-(big-)endian byte array. 252 | */ 253 | static INLINE void 254 | hton32_ua_store(uint32 val, uint8 *bytes) 255 | { 256 | bytes[0] = val >> 24; 257 | bytes[1] = (val >> 16) & 0xff; 258 | bytes[2] = (val >> 8) & 0xff; 259 | bytes[3] = val & 0xff; 260 | } 261 | 262 | /* 263 | * Load 16-bit value from unaligned little-endian byte array. 264 | */ 265 | static INLINE uint16 266 | ltoh16_ua(const void *bytes) 267 | { 268 | return _LTOH16_UA((const uint8 *)bytes); 269 | } 270 | 271 | /* 272 | * Load 32-bit value from unaligned little-endian byte array. 273 | */ 274 | static INLINE uint32 275 | ltoh32_ua(const void *bytes) 276 | { 277 | return _LTOH32_UA((const uint8 *)bytes); 278 | } 279 | 280 | /* 281 | * Load 16-bit value from unaligned big-(network-)endian byte array. 282 | */ 283 | static INLINE uint16 284 | ntoh16_ua(const void *bytes) 285 | { 286 | return _NTOH16_UA((const uint8 *)bytes); 287 | } 288 | 289 | /* 290 | * Load 32-bit value from unaligned big-(network-)endian byte array. 291 | */ 292 | static INLINE uint32 293 | ntoh32_ua(const void *bytes) 294 | { 295 | return _NTOH32_UA((const uint8 *)bytes); 296 | } 297 | 298 | #endif /* !__GNUC__ */ 299 | #endif /* !_BCMENDIAN_H_ */ 300 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/bcmperf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Performance counters software interface. 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: bcmperf.h 241182 2011-02-17 21:50:03Z $ 25 | */ 26 | /* essai */ 27 | #ifndef _BCMPERF_H_ 28 | #define _BCMPERF_H_ 29 | /* get cache hits and misses */ 30 | #define BCMPERF_ENABLE_INSTRCOUNT() 31 | #define BCMPERF_ENABLE_ICACHE_MISS() 32 | #define BCMPERF_ENABLE_ICACHE_HIT() 33 | #define BCMPERF_GETICACHE_MISS(x) ((x) = 0) 34 | #define BCMPERF_GETICACHE_HIT(x) ((x) = 0) 35 | #define BCMPERF_GETINSTRCOUNT(x) ((x) = 0) 36 | #endif /* _BCMPERF_H_ */ 37 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/bcmsdbus.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions for API from sdio common code (bcmsdh) to individual 3 | * host controller drivers. 4 | * 5 | * Copyright (C) 1999-2012, Broadcom Corporation 6 | * 7 | * Unless you and Broadcom execute a separate written software license 8 | * agreement governing use of this software, this software is licensed to you 9 | * under the terms of the GNU General Public License version 2 (the "GPL"), 10 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 11 | * following added to such license: 12 | * 13 | * As a special exception, the copyright holders of this software give you 14 | * permission to link this software with independent modules, and to copy and 15 | * distribute the resulting executable under terms of your choice, provided that 16 | * you also meet, for each linked independent module, the terms and conditions of 17 | * the license of that module. An independent module is a module which is not 18 | * derived from this software. The special exception does not apply to any 19 | * modifications of the software. 20 | * 21 | * Notwithstanding the above, under no circumstances may you combine this 22 | * software in any way with any other Broadcom software provided under a license 23 | * other than the GPL, without Broadcom's express prior written consent. 24 | * 25 | * $Id: bcmsdbus.h 347614 2012-07-27 10:24:51Z $ 26 | */ 27 | 28 | #ifndef _sdio_api_h_ 29 | #define _sdio_api_h_ 30 | 31 | 32 | #define SDIOH_API_RC_SUCCESS (0x00) 33 | #define SDIOH_API_RC_FAIL (0x01) 34 | #define SDIOH_API_SUCCESS(status) (status == 0) 35 | 36 | #define SDIOH_READ 0 /* Read request */ 37 | #define SDIOH_WRITE 1 /* Write request */ 38 | 39 | #define SDIOH_DATA_FIX 0 /* Fixed addressing */ 40 | #define SDIOH_DATA_INC 1 /* Incremental addressing */ 41 | 42 | #define SDIOH_CMD_TYPE_NORMAL 0 /* Normal command */ 43 | #define SDIOH_CMD_TYPE_APPEND 1 /* Append command */ 44 | #define SDIOH_CMD_TYPE_CUTTHRU 2 /* Cut-through command */ 45 | 46 | #define SDIOH_DATA_PIO 0 /* PIO mode */ 47 | #define SDIOH_DATA_DMA 1 /* DMA mode */ 48 | 49 | #ifdef BCMSDIOH_TXGLOM 50 | /* Max number of glommed pkts */ 51 | #define SDPCM_MAXGLOM_SIZE 10 52 | #define SDPCM_DEFGLOM_SIZE 3 53 | 54 | #define SDPCM_TXGLOM_CPY 0 /* SDIO 2.0 should use copy mode */ 55 | #define SDPCM_TXGLOM_MDESC 1 /* SDIO 3.0 should use multi-desc mode */ 56 | #endif 57 | 58 | 59 | typedef int SDIOH_API_RC; 60 | 61 | /* SDio Host structure */ 62 | typedef struct sdioh_info sdioh_info_t; 63 | 64 | /* callback function, taking one arg */ 65 | typedef void (*sdioh_cb_fn_t)(void *); 66 | 67 | /* attach, return handler on success, NULL if failed. 68 | * The handler shall be provided by all subsequent calls. No local cache 69 | * cfghdl points to the starting address of pci device mapped memory 70 | */ 71 | extern sdioh_info_t * sdioh_attach(osl_t *osh, void *cfghdl, uint irq); 72 | extern SDIOH_API_RC sdioh_detach(osl_t *osh, sdioh_info_t *si); 73 | extern SDIOH_API_RC sdioh_interrupt_register(sdioh_info_t *si, sdioh_cb_fn_t fn, void *argh); 74 | extern SDIOH_API_RC sdioh_interrupt_deregister(sdioh_info_t *si); 75 | 76 | /* query whether SD interrupt is enabled or not */ 77 | extern SDIOH_API_RC sdioh_interrupt_query(sdioh_info_t *si, bool *onoff); 78 | 79 | /* enable or disable SD interrupt */ 80 | extern SDIOH_API_RC sdioh_interrupt_set(sdioh_info_t *si, bool enable_disable); 81 | 82 | #if defined(DHD_DEBUG) 83 | extern bool sdioh_interrupt_pending(sdioh_info_t *si); 84 | #endif 85 | 86 | /* read or write one byte using cmd52 */ 87 | extern SDIOH_API_RC sdioh_request_byte(sdioh_info_t *si, uint rw, uint fnc, uint addr, uint8 *byte); 88 | 89 | /* read or write 2/4 bytes using cmd53 */ 90 | extern SDIOH_API_RC sdioh_request_word(sdioh_info_t *si, uint cmd_type, uint rw, uint fnc, 91 | uint addr, uint32 *word, uint nbyte); 92 | 93 | /* read or write any buffer using cmd53 */ 94 | extern SDIOH_API_RC sdioh_request_buffer(sdioh_info_t *si, uint pio_dma, uint fix_inc, 95 | uint rw, uint fnc_num, uint32 addr, uint regwidth, uint32 buflen, uint8 *buffer, 96 | void *pkt); 97 | 98 | #ifdef BCMSDIOH_TXGLOM 99 | extern void sdioh_glom_post(sdioh_info_t *sd, uint8 *frame, uint len); 100 | extern void sdioh_glom_clear(sdioh_info_t *sd); 101 | extern uint sdioh_set_mode(sdioh_info_t *sd, uint mode); 102 | extern bool sdioh_glom_enabled(void); 103 | #else 104 | #define sdioh_glom_post(a, b, c) 105 | #define sdioh_glom_clear(a) 106 | #define sdioh_set_mode(a) (0) 107 | #define sdioh_glom_enabled() (FALSE) 108 | #endif 109 | 110 | /* get cis data */ 111 | extern SDIOH_API_RC sdioh_cis_read(sdioh_info_t *si, uint fuc, uint8 *cis, uint32 length); 112 | 113 | extern SDIOH_API_RC sdioh_cfg_read(sdioh_info_t *si, uint fuc, uint32 addr, uint8 *data); 114 | extern SDIOH_API_RC sdioh_cfg_write(sdioh_info_t *si, uint fuc, uint32 addr, uint8 *data); 115 | 116 | /* query number of io functions */ 117 | extern uint sdioh_query_iofnum(sdioh_info_t *si); 118 | 119 | /* handle iovars */ 120 | extern int sdioh_iovar_op(sdioh_info_t *si, const char *name, 121 | void *params, int plen, void *arg, int len, bool set); 122 | 123 | /* Issue abort to the specified function and clear controller as needed */ 124 | extern int sdioh_abort(sdioh_info_t *si, uint fnc); 125 | 126 | /* Start and Stop SDIO without re-enumerating the SD card. */ 127 | extern int sdioh_start(sdioh_info_t *si, int stage); 128 | extern int sdioh_stop(sdioh_info_t *si); 129 | 130 | /* Wait system lock free */ 131 | extern int sdioh_waitlockfree(sdioh_info_t *si); 132 | 133 | /* Reset and re-initialize the device */ 134 | extern int sdioh_sdio_reset(sdioh_info_t *si); 135 | 136 | /* Helper function */ 137 | void *bcmsdh_get_sdioh(bcmsdh_info_t *sdh); 138 | 139 | 140 | 141 | #if defined(BCMSDIOH_STD) 142 | #define SDIOH_SLEEP_ENABLED 143 | #endif 144 | extern SDIOH_API_RC sdioh_sleep(sdioh_info_t *si, bool enab); 145 | 146 | /* GPIO support */ 147 | extern SDIOH_API_RC sdioh_gpio_init(sdioh_info_t *sd); 148 | extern bool sdioh_gpioin(sdioh_info_t *sd, uint32 gpio); 149 | extern SDIOH_API_RC sdioh_gpioouten(sdioh_info_t *sd, uint32 gpio); 150 | extern SDIOH_API_RC sdioh_gpioout(sdioh_info_t *sd, uint32 gpio, bool enab); 151 | 152 | #endif /* _sdio_api_h_ */ 153 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/bcmsdh_sdmmc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * BCMSDH Function Driver for the native SDIO/MMC driver in the Linux Kernel 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: bcmsdh_sdmmc.h 366812 2012-11-05 13:49:32Z $ 25 | */ 26 | 27 | #ifndef __BCMSDH_SDMMC_H__ 28 | #define __BCMSDH_SDMMC_H__ 29 | 30 | #define sd_sync_dma(sd, read, nbytes) 31 | #define sd_init_dma(sd) 32 | #define sd_ack_intr(sd) 33 | #define sd_wakeup(sd); 34 | 35 | /* Allocate/init/free per-OS private data */ 36 | extern int sdioh_sdmmc_osinit(sdioh_info_t *sd); 37 | extern void sdioh_sdmmc_osfree(sdioh_info_t *sd); 38 | 39 | #define BLOCK_SIZE_4318 64 40 | #define BLOCK_SIZE_4328 512 41 | 42 | /* internal return code */ 43 | #define SUCCESS 0 44 | #define ERROR 1 45 | 46 | /* private bus modes */ 47 | #define SDIOH_MODE_SD4 2 48 | #define CLIENT_INTR 0x100 /* Get rid of this! */ 49 | 50 | struct sdioh_info { 51 | osl_t *osh; /* osh handler */ 52 | bool client_intr_enabled; /* interrupt connnected flag */ 53 | bool intr_handler_valid; /* client driver interrupt handler valid */ 54 | sdioh_cb_fn_t intr_handler; /* registered interrupt handler */ 55 | void *intr_handler_arg; /* argument to call interrupt handler */ 56 | uint16 intmask; /* Current active interrupts */ 57 | void *sdos_info; /* Pointer to per-OS private data */ 58 | 59 | uint irq; /* Client irq */ 60 | int intrcount; /* Client interrupts */ 61 | 62 | bool sd_use_dma; /* DMA on CMD53 */ 63 | bool sd_blockmode; /* sd_blockmode == FALSE => 64 Byte Cmd 53s. */ 64 | /* Must be on for sd_multiblock to be effective */ 65 | bool use_client_ints; /* If this is false, make sure to restore */ 66 | int sd_mode; /* SD1/SD4/SPI */ 67 | int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */ 68 | uint8 num_funcs; /* Supported funcs on client */ 69 | uint32 com_cis_ptr; 70 | uint32 func_cis_ptr[SDIOD_MAX_IOFUNCS]; 71 | 72 | #define SDIOH_SDMMC_MAX_SG_ENTRIES 32 73 | struct scatterlist sg_list[SDIOH_SDMMC_MAX_SG_ENTRIES]; 74 | bool use_rxchain; 75 | }; 76 | 77 | /************************************************************ 78 | * Internal interfaces: per-port references into bcmsdh_sdmmc.c 79 | */ 80 | 81 | /* Global message bits */ 82 | extern uint sd_msglevel; 83 | 84 | /* OS-independent interrupt handler */ 85 | extern bool check_client_intr(sdioh_info_t *sd); 86 | 87 | /* Core interrupt enable/disable of device interrupts */ 88 | extern void sdioh_sdmmc_devintr_on(sdioh_info_t *sd); 89 | extern void sdioh_sdmmc_devintr_off(sdioh_info_t *sd); 90 | 91 | 92 | /************************************************************** 93 | * Internal interfaces: bcmsdh_sdmmc.c references to per-port code 94 | */ 95 | 96 | /* Register mapping routines */ 97 | extern uint32 *sdioh_sdmmc_reg_map(osl_t *osh, int32 addr, int size); 98 | extern void sdioh_sdmmc_reg_unmap(osl_t *osh, int32 addr, int size); 99 | 100 | /* Interrupt (de)registration routines */ 101 | extern int sdioh_sdmmc_register_irq(sdioh_info_t *sd, uint irq); 102 | extern void sdioh_sdmmc_free_irq(uint irq, sdioh_info_t *sd); 103 | 104 | typedef struct _BCMSDH_SDMMC_INSTANCE { 105 | sdioh_info_t *sd; 106 | struct sdio_func *func[SDIOD_MAX_IOFUNCS]; 107 | } BCMSDH_SDMMC_INSTANCE, *PBCMSDH_SDMMC_INSTANCE; 108 | 109 | #endif /* __BCMSDH_SDMMC_H__ */ 110 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/bcmsdspi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SD-SPI Protocol Conversion - BCMSDH->SPI Translation Layer 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: bcmsdspi.h 294363 2011-11-06 23:02:20Z $ 25 | */ 26 | #ifndef _BCM_SD_SPI_H 27 | #define _BCM_SD_SPI_H 28 | 29 | #define BLOCK_SIZE_4318 64 30 | #define BLOCK_SIZE_4328 512 31 | 32 | /* internal return code */ 33 | #define SUCCESS 0 34 | #undef ERROR 35 | #define ERROR 1 36 | 37 | /* private bus modes */ 38 | #define SDIOH_MODE_SPI 0 39 | 40 | #define USE_BLOCKMODE 0x2 /* Block mode can be single block or multi */ 41 | #define USE_MULTIBLOCK 0x4 42 | 43 | struct sdioh_info { 44 | uint cfg_bar; /* pci cfg address for bar */ 45 | uint32 caps; /* cached value of capabilities reg */ 46 | uint bar0; /* BAR0 for PCI Device */ 47 | osl_t *osh; /* osh handler */ 48 | void *controller; /* Pointer to SPI Controller's private data struct */ 49 | 50 | uint lockcount; /* nest count of sdspi_lock() calls */ 51 | bool client_intr_enabled; /* interrupt connnected flag */ 52 | bool intr_handler_valid; /* client driver interrupt handler valid */ 53 | sdioh_cb_fn_t intr_handler; /* registered interrupt handler */ 54 | void *intr_handler_arg; /* argument to call interrupt handler */ 55 | bool initialized; /* card initialized */ 56 | uint32 target_dev; /* Target device ID */ 57 | uint32 intmask; /* Current active interrupts */ 58 | void *sdos_info; /* Pointer to per-OS private data */ 59 | 60 | uint32 controller_type; /* Host controller type */ 61 | uint8 version; /* Host Controller Spec Compliance Version */ 62 | uint irq; /* Client irq */ 63 | uint32 intrcount; /* Client interrupts */ 64 | uint32 local_intrcount; /* Controller interrupts */ 65 | bool host_init_done; /* Controller initted */ 66 | bool card_init_done; /* Client SDIO interface initted */ 67 | bool polled_mode; /* polling for command completion */ 68 | 69 | bool sd_use_dma; /* DMA on CMD53 */ 70 | bool sd_blockmode; /* sd_blockmode == FALSE => 64 Byte Cmd 53s. */ 71 | /* Must be on for sd_multiblock to be effective */ 72 | bool use_client_ints; /* If this is false, make sure to restore */ 73 | bool got_hcint; /* Host Controller interrupt. */ 74 | /* polling hack in wl_linux.c:wl_timer() */ 75 | int adapter_slot; /* Maybe dealing with multiple slots/controllers */ 76 | int sd_mode; /* SD1/SD4/SPI */ 77 | int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */ 78 | uint32 data_xfer_count; /* Current register transfer size */ 79 | uint32 cmd53_wr_data; /* Used to pass CMD53 write data */ 80 | uint32 card_response; /* Used to pass back response status byte */ 81 | uint32 card_rsp_data; /* Used to pass back response data word */ 82 | uint16 card_rca; /* Current Address */ 83 | uint8 num_funcs; /* Supported funcs on client */ 84 | uint32 com_cis_ptr; 85 | uint32 func_cis_ptr[SDIOD_MAX_IOFUNCS]; 86 | void *dma_buf; 87 | ulong dma_phys; 88 | int r_cnt; /* rx count */ 89 | int t_cnt; /* tx_count */ 90 | }; 91 | 92 | /************************************************************ 93 | * Internal interfaces: per-port references into bcmsdspi.c 94 | */ 95 | 96 | /* Global message bits */ 97 | extern uint sd_msglevel; 98 | 99 | /************************************************************** 100 | * Internal interfaces: bcmsdspi.c references to per-port code 101 | */ 102 | 103 | /* Register mapping routines */ 104 | extern uint32 *spi_reg_map(osl_t *osh, uintptr addr, int size); 105 | extern void spi_reg_unmap(osl_t *osh, uintptr addr, int size); 106 | 107 | /* Interrupt (de)registration routines */ 108 | extern int spi_register_irq(sdioh_info_t *sd, uint irq); 109 | extern void spi_free_irq(uint irq, sdioh_info_t *sd); 110 | 111 | /* OS-specific interrupt wrappers (atomic interrupt enable/disable) */ 112 | extern void spi_lock(sdioh_info_t *sd); 113 | extern void spi_unlock(sdioh_info_t *sd); 114 | 115 | /* Allocate/init/free per-OS private data */ 116 | extern int spi_osinit(sdioh_info_t *sd); 117 | extern void spi_osfree(sdioh_info_t *sd); 118 | 119 | #endif /* _BCM_SD_SPI_H */ 120 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/bcmspi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Broadcom SPI Low-Level Hardware Driver API 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: bcmspi.h 241182 2011-02-17 21:50:03Z $ 25 | */ 26 | #ifndef _BCM_SPI_H 27 | #define _BCM_SPI_H 28 | 29 | extern void spi_devintr_off(sdioh_info_t *sd); 30 | extern void spi_devintr_on(sdioh_info_t *sd); 31 | extern bool spi_start_clock(sdioh_info_t *sd, uint16 new_sd_divisor); 32 | extern bool spi_controller_highspeed_mode(sdioh_info_t *sd, bool hsmode); 33 | extern bool spi_check_client_intr(sdioh_info_t *sd, int *is_dev_intr); 34 | extern bool spi_hw_attach(sdioh_info_t *sd); 35 | extern bool spi_hw_detach(sdioh_info_t *sd); 36 | extern void spi_sendrecv(sdioh_info_t *sd, uint8 *msg_out, uint8 *msg_in, int msglen); 37 | extern void spi_spinbits(sdioh_info_t *sd); 38 | extern void spi_waitbits(sdioh_info_t *sd, bool yield); 39 | 40 | #endif /* _BCM_SPI_H */ 41 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/dhdioctl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions for ioctls to access DHD iovars. 3 | * Based on wlioctl.h (for Broadcom 802.11abg driver). 4 | * (Moves towards generic ioctls for BCM drivers/iovars.) 5 | * 6 | * Definitions subject to change without notice. 7 | * 8 | * Copyright (C) 1999-2012, Broadcom Corporation 9 | * 10 | * Unless you and Broadcom execute a separate written software license 11 | * agreement governing use of this software, this software is licensed to you 12 | * under the terms of the GNU General Public License version 2 (the "GPL"), 13 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 14 | * following added to such license: 15 | * 16 | * As a special exception, the copyright holders of this software give you 17 | * permission to link this software with independent modules, and to copy and 18 | * distribute the resulting executable under terms of your choice, provided that 19 | * you also meet, for each linked independent module, the terms and conditions of 20 | * the license of that module. An independent module is a module which is not 21 | * derived from this software. The special exception does not apply to any 22 | * modifications of the software. 23 | * 24 | * Notwithstanding the above, under no circumstances may you combine this 25 | * software in any way with any other Broadcom software provided under a license 26 | * other than the GPL, without Broadcom's express prior written consent. 27 | * 28 | * $Id: dhdioctl.h 354894 2012-09-04 12:34:07Z $ 29 | */ 30 | 31 | #ifndef _dhdioctl_h_ 32 | #define _dhdioctl_h_ 33 | 34 | #include 35 | 36 | 37 | /* require default structure packing */ 38 | #define BWL_DEFAULT_PACKING 39 | #include 40 | 41 | 42 | /* Linux network driver ioctl encoding */ 43 | typedef struct dhd_ioctl { 44 | uint cmd; /* common ioctl definition */ 45 | void *buf; /* pointer to user buffer */ 46 | uint len; /* length of user buffer */ 47 | bool set; /* get or set request (optional) */ 48 | uint used; /* bytes read or written (optional) */ 49 | uint needed; /* bytes needed (optional) */ 50 | uint driver; /* to identify target driver */ 51 | } dhd_ioctl_t; 52 | 53 | /* Underlying BUS definition */ 54 | enum { 55 | BUS_TYPE_USB = 0, /* for USB dongles */ 56 | BUS_TYPE_SDIO /* for SDIO dongles */ 57 | }; 58 | 59 | /* per-driver magic numbers */ 60 | #define DHD_IOCTL_MAGIC 0x00444944 61 | 62 | /* bump this number if you change the ioctl interface */ 63 | #define DHD_IOCTL_VERSION 1 64 | 65 | #define DHD_IOCTL_MAXLEN 8192 /* max length ioctl buffer required */ 66 | #define DHD_IOCTL_SMLEN 256 /* "small" length ioctl buffer required */ 67 | 68 | /* common ioctl definitions */ 69 | #define DHD_GET_MAGIC 0 70 | #define DHD_GET_VERSION 1 71 | #define DHD_GET_VAR 2 72 | #define DHD_SET_VAR 3 73 | 74 | /* message levels */ 75 | #define DHD_ERROR_VAL 0x0001 76 | #define DHD_TRACE_VAL 0x0002 77 | #define DHD_INFO_VAL 0x0004 78 | #define DHD_DATA_VAL 0x0008 79 | #define DHD_CTL_VAL 0x0010 80 | #define DHD_TIMER_VAL 0x0020 81 | #define DHD_HDRS_VAL 0x0040 82 | #define DHD_BYTES_VAL 0x0080 83 | #define DHD_INTR_VAL 0x0100 84 | #define DHD_LOG_VAL 0x0200 85 | #define DHD_GLOM_VAL 0x0400 86 | #define DHD_EVENT_VAL 0x0800 87 | #define DHD_BTA_VAL 0x1000 88 | #if 0 && (NDISVER >= 0x0630) && 1 89 | #define DHD_SCAN_VAL 0x2000 90 | #else 91 | #define DHD_ISCAN_VAL 0x2000 92 | #endif 93 | #define DHD_ARPOE_VAL 0x4000 94 | #define DHD_REORDER_VAL 0x8000 95 | #define DHD_IW_VAL 0x10000 96 | #define DHD_CFG_VAL 0x20000 97 | 98 | #ifdef SDTEST 99 | /* For pktgen iovar */ 100 | typedef struct dhd_pktgen { 101 | uint version; /* To allow structure change tracking */ 102 | uint freq; /* Max ticks between tx/rx attempts */ 103 | uint count; /* Test packets to send/rcv each attempt */ 104 | uint print; /* Print counts every attempts */ 105 | uint total; /* Total packets (or bursts) */ 106 | uint minlen; /* Minimum length of packets to send */ 107 | uint maxlen; /* Maximum length of packets to send */ 108 | uint numsent; /* Count of test packets sent */ 109 | uint numrcvd; /* Count of test packets received */ 110 | uint numfail; /* Count of test send failures */ 111 | uint mode; /* Test mode (type of test packets) */ 112 | uint stop; /* Stop after this many tx failures */ 113 | } dhd_pktgen_t; 114 | 115 | /* Version in case structure changes */ 116 | #define DHD_PKTGEN_VERSION 2 117 | 118 | /* Type of test packets to use */ 119 | #define DHD_PKTGEN_ECHO 1 /* Send echo requests */ 120 | #define DHD_PKTGEN_SEND 2 /* Send discard packets */ 121 | #define DHD_PKTGEN_RXBURST 3 /* Request dongle send N packets */ 122 | #define DHD_PKTGEN_RECV 4 /* Continuous rx from continuous tx dongle */ 123 | #endif /* SDTEST */ 124 | 125 | /* Enter idle immediately (no timeout) */ 126 | #define DHD_IDLE_IMMEDIATE (-1) 127 | 128 | /* Values for idleclock iovar: other values are the sd_divisor to use when idle */ 129 | #define DHD_IDLE_ACTIVE 0 /* Do not request any SD clock change when idle */ 130 | #define DHD_IDLE_STOP (-1) /* Request SD clock be stopped (and use SD1 mode) */ 131 | 132 | 133 | /* require default structure packing */ 134 | #include 135 | 136 | #endif /* _dhdioctl_h_ */ 137 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/epivers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2012, Broadcom Corporation 3 | * 4 | * Unless you and Broadcom execute a separate written software license 5 | * agreement governing use of this software, this software is licensed to you 6 | * under the terms of the GNU General Public License version 2 (the "GPL"), 7 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 8 | * following added to such license: 9 | * 10 | * As a special exception, the copyright holders of this software give you 11 | * permission to link this software with independent modules, and to copy and 12 | * distribute the resulting executable under terms of your choice, provided that 13 | * you also meet, for each linked independent module, the terms and conditions of 14 | * the license of that module. An independent module is a module which is not 15 | * derived from this software. The special exception does not apply to any 16 | * modifications of the software. 17 | * 18 | * Notwithstanding the above, under no circumstances may you combine this 19 | * software in any way with any other Broadcom software provided under a license 20 | * other than the GPL, without Broadcom's express prior written consent. 21 | * 22 | * $Id: epivers.h.in,v 13.33 2010-09-08 22:08:53 csm Exp $ 23 | * 24 | */ 25 | 26 | #ifndef _epivers_h_ 27 | #define _epivers_h_ 28 | 29 | #define EPI_MAJOR_VERSION 1 30 | 31 | #define EPI_MINOR_VERSION 28 32 | 33 | #define EPI_RC_NUMBER 23 34 | 35 | #define EPI_INCREMENTAL_NUMBER 0 36 | 37 | #define EPI_BUILD_NUMBER 0 38 | 39 | #define EPI_VERSION 1, 28, 23, 0 40 | 41 | #define EPI_VERSION_NUM 0x011c1700 42 | 43 | #define EPI_VERSION_DEV 1.28.23 44 | 45 | /* Driver Version String, ASCII, 32 chars max */ 46 | #ifdef BCMINTERNAL 47 | #define EPI_VERSION_STR "1.28.23.3 (r BCMINT)" 48 | #else 49 | #ifdef WLTEST 50 | #define EPI_VERSION_STR "1.28.23.3 (r WLTEST)" 51 | #else 52 | #define EPI_VERSION_STR "1.28.23.3 (r)" 53 | #endif 54 | #endif /* BCMINTERNAL */ 55 | 56 | #endif /* _epivers_h_ */ 57 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/hndpmu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * HND SiliconBackplane PMU support. 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: hndpmu.h 241182 2011-02-17 21:50:03Z $ 25 | */ 26 | 27 | #ifndef _hndpmu_h_ 28 | #define _hndpmu_h_ 29 | 30 | 31 | extern void si_pmu_otp_power(si_t *sih, osl_t *osh, bool on); 32 | extern void si_sdiod_drive_strength_init(si_t *sih, osl_t *osh, uint32 drivestrength); 33 | 34 | extern void si_pmu_minresmask_htavail_set(si_t *sih, osl_t *osh, bool set_clear); 35 | 36 | #endif /* _hndpmu_h_ */ 37 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/hndrte_armtrap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * HNDRTE arm trap handling. 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: hndrte_armtrap.h 261365 2011-05-24 20:42:23Z $ 25 | */ 26 | 27 | #ifndef _hndrte_armtrap_h 28 | #define _hndrte_armtrap_h 29 | 30 | 31 | /* ARM trap handling */ 32 | 33 | /* Trap types defined by ARM (see arminc.h) */ 34 | 35 | /* Trap locations in lo memory */ 36 | #define TRAP_STRIDE 4 37 | #define FIRST_TRAP TR_RST 38 | #define LAST_TRAP (TR_FIQ * TRAP_STRIDE) 39 | 40 | #if defined(__ARM_ARCH_4T__) 41 | #define MAX_TRAP_TYPE (TR_FIQ + 1) 42 | #elif defined(__ARM_ARCH_7M__) 43 | #define MAX_TRAP_TYPE (TR_ISR + ARMCM3_NUMINTS) 44 | #endif /* __ARM_ARCH_7M__ */ 45 | 46 | /* The trap structure is defined here as offsets for assembly */ 47 | #define TR_TYPE 0x00 48 | #define TR_EPC 0x04 49 | #define TR_CPSR 0x08 50 | #define TR_SPSR 0x0c 51 | #define TR_REGS 0x10 52 | #define TR_REG(n) (TR_REGS + (n) * 4) 53 | #define TR_SP TR_REG(13) 54 | #define TR_LR TR_REG(14) 55 | #define TR_PC TR_REG(15) 56 | 57 | #define TRAP_T_SIZE 80 58 | 59 | #ifndef _LANGUAGE_ASSEMBLY 60 | 61 | #include 62 | 63 | typedef struct _trap_struct { 64 | uint32 type; 65 | uint32 epc; 66 | uint32 cpsr; 67 | uint32 spsr; 68 | uint32 r0; /* a1 */ 69 | uint32 r1; /* a2 */ 70 | uint32 r2; /* a3 */ 71 | uint32 r3; /* a4 */ 72 | uint32 r4; /* v1 */ 73 | uint32 r5; /* v2 */ 74 | uint32 r6; /* v3 */ 75 | uint32 r7; /* v4 */ 76 | uint32 r8; /* v5 */ 77 | uint32 r9; /* sb/v6 */ 78 | uint32 r10; /* sl/v7 */ 79 | uint32 r11; /* fp/v8 */ 80 | uint32 r12; /* ip */ 81 | uint32 r13; /* sp */ 82 | uint32 r14; /* lr */ 83 | uint32 pc; /* r15 */ 84 | } trap_t; 85 | 86 | #endif /* !_LANGUAGE_ASSEMBLY */ 87 | 88 | #endif /* _hndrte_armtrap_h */ 89 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/hndrte_cons.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Console support for hndrte. 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: hndrte_cons.h 300516 2011-12-04 17:39:44Z $ 25 | */ 26 | #ifndef _HNDRTE_CONS_H 27 | #define _HNDRTE_CONS_H 28 | 29 | #include 30 | 31 | #define CBUF_LEN (128) 32 | 33 | #define LOG_BUF_LEN 1024 34 | 35 | typedef struct { 36 | uint32 buf; /* Can't be pointer on (64-bit) hosts */ 37 | uint buf_size; 38 | uint idx; 39 | char *_buf_compat; /* redundant pointer for backward compat. */ 40 | } hndrte_log_t; 41 | 42 | typedef struct { 43 | /* Virtual UART 44 | * When there is no UART (e.g. Quickturn), the host should write a complete 45 | * input line directly into cbuf and then write the length into vcons_in. 46 | * This may also be used when there is a real UART (at risk of conflicting with 47 | * the real UART). vcons_out is currently unused. 48 | */ 49 | volatile uint vcons_in; 50 | volatile uint vcons_out; 51 | 52 | /* Output (logging) buffer 53 | * Console output is written to a ring buffer log_buf at index log_idx. 54 | * The host may read the output when it sees log_idx advance. 55 | * Output will be lost if the output wraps around faster than the host polls. 56 | */ 57 | hndrte_log_t log; 58 | 59 | /* Console input line buffer 60 | * Characters are read one at a time into cbuf until is received, then 61 | * the buffer is processed as a command line. Also used for virtual UART. 62 | */ 63 | uint cbuf_idx; 64 | char cbuf[CBUF_LEN]; 65 | } hndrte_cons_t; 66 | 67 | #endif /* _HNDRTE_CONS_H */ 68 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/miniopt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Command line options parser. 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * $Id: miniopt.h 241182 2011-02-17 21:50:03Z $ 24 | */ 25 | 26 | 27 | #ifndef MINI_OPT_H 28 | #define MINI_OPT_H 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | /* ---- Include Files ---------------------------------------------------- */ 35 | /* ---- Constants and Types ---------------------------------------------- */ 36 | 37 | #define MINIOPT_MAXKEY 128 /* Max options */ 38 | typedef struct miniopt { 39 | 40 | /* These are persistent after miniopt_init() */ 41 | const char* name; /* name for prompt in error strings */ 42 | const char* flags; /* option chars that take no args */ 43 | bool longflags; /* long options may be flags */ 44 | bool opt_end; /* at end of options (passed a "--") */ 45 | 46 | /* These are per-call to miniopt() */ 47 | 48 | int consumed; /* number of argv entries cosumed in 49 | * the most recent call to miniopt() 50 | */ 51 | bool positional; 52 | bool good_int; /* 'val' member is the result of a sucessful 53 | * strtol conversion of the option value 54 | */ 55 | char opt; 56 | char key[MINIOPT_MAXKEY]; 57 | char* valstr; /* positional param, or value for the option, 58 | * or null if the option had 59 | * no accompanying value 60 | */ 61 | uint uval; /* strtol translation of valstr */ 62 | int val; /* strtol translation of valstr */ 63 | } miniopt_t; 64 | 65 | void miniopt_init(miniopt_t *t, const char* name, const char* flags, bool longflags); 66 | int miniopt(miniopt_t *t, char **argv); 67 | 68 | 69 | /* ---- Variable Externs ------------------------------------------------- */ 70 | /* ---- Function Prototypes ---------------------------------------------- */ 71 | 72 | 73 | #ifdef __cplusplus 74 | } 75 | #endif 76 | 77 | #endif /* MINI_OPT_H */ 78 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/msgtrace.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Trace messages sent over HBUS 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: msgtrace.h 281527 2011-09-02 17:12:53Z $ 25 | */ 26 | 27 | #ifndef _MSGTRACE_H 28 | #define _MSGTRACE_H 29 | 30 | #ifndef _TYPEDEFS_H_ 31 | #include 32 | #endif 33 | 34 | 35 | /* This marks the start of a packed structure section. */ 36 | #include 37 | 38 | #define MSGTRACE_VERSION 1 39 | 40 | /* Message trace header */ 41 | typedef BWL_PRE_PACKED_STRUCT struct msgtrace_hdr { 42 | uint8 version; 43 | uint8 spare; 44 | uint16 len; /* Len of the trace */ 45 | uint32 seqnum; /* Sequence number of message. Useful if the messsage has been lost 46 | * because of DMA error or a bus reset (ex: SDIO Func2) 47 | */ 48 | uint32 discarded_bytes; /* Number of discarded bytes because of trace overflow */ 49 | uint32 discarded_printf; /* Number of discarded printf because of trace overflow */ 50 | } BWL_POST_PACKED_STRUCT msgtrace_hdr_t; 51 | 52 | #define MSGTRACE_HDRLEN sizeof(msgtrace_hdr_t) 53 | 54 | /* The hbus driver generates traces when sending a trace message. This causes endless traces. 55 | * This flag must be set to TRUE in any hbus traces. The flag is reset in the function msgtrace_put. 56 | * This prevents endless traces but generates hasardous lost of traces only in bus device code. 57 | * It is recommendat to set this flag in macro SD_TRACE but not in SD_ERROR for avoiding missing 58 | * hbus error traces. hbus error trace should not generates endless traces. 59 | */ 60 | extern bool msgtrace_hbus_trace; 61 | 62 | typedef void (*msgtrace_func_send_t)(void *hdl1, void *hdl2, uint8 *hdr, 63 | uint16 hdrlen, uint8 *buf, uint16 buflen); 64 | extern void msgtrace_start(void); 65 | extern void msgtrace_stop(void); 66 | extern void msgtrace_sent(void); 67 | extern void msgtrace_put(char *buf, int count); 68 | extern void msgtrace_init(void *hdl1, void *hdl2, msgtrace_func_send_t func_send); 69 | extern bool msgtrace_event_enabled(void); 70 | 71 | /* This marks the end of a packed structure section. */ 72 | #include 73 | 74 | #endif /* _MSGTRACE_H */ 75 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/osl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * OS Abstraction Layer 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: osl.h 320905 2012-03-13 15:33:25Z $ 25 | */ 26 | 27 | #ifndef _osl_h_ 28 | #define _osl_h_ 29 | 30 | /* osl handle type forward declaration */ 31 | typedef struct osl_info osl_t; 32 | typedef struct osl_dmainfo osldma_t; 33 | 34 | #define OSL_PKTTAG_SZ 32 /* Size of PktTag */ 35 | 36 | /* Drivers use PKTFREESETCB to register a callback function when a packet is freed by OSL */ 37 | typedef void (*pktfree_cb_fn_t)(void *ctx, void *pkt, unsigned int status); 38 | 39 | /* Drivers use REGOPSSET() to register register read/write funcitons */ 40 | typedef unsigned int (*osl_rreg_fn_t)(void *ctx, volatile void *reg, unsigned int size); 41 | typedef void (*osl_wreg_fn_t)(void *ctx, volatile void *reg, unsigned int val, unsigned int size); 42 | 43 | 44 | #include 45 | 46 | #ifndef PKTDBG_TRACE 47 | #define PKTDBG_TRACE(osh, pkt, bit) 48 | #endif 49 | 50 | #define PKTCTFMAP(osh, p) 51 | 52 | /* -------------------------------------------------------------------------- 53 | ** Register manipulation macros. 54 | */ 55 | 56 | #define SET_REG(osh, r, mask, val) W_REG((osh), (r), ((R_REG((osh), r) & ~(mask)) | (val))) 57 | 58 | #ifndef AND_REG 59 | #define AND_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) & (v)) 60 | #endif /* !AND_REG */ 61 | 62 | #ifndef OR_REG 63 | #define OR_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) | (v)) 64 | #endif /* !OR_REG */ 65 | 66 | #if !defined(OSL_SYSUPTIME) 67 | #define OSL_SYSUPTIME() (0) 68 | #define OSL_SYSUPTIME_SUPPORT FALSE 69 | #else 70 | #define OSL_SYSUPTIME_SUPPORT TRUE 71 | #endif /* OSL_SYSUPTIME */ 72 | 73 | #if !defined(PKTC) 74 | #define PKTCCNT(skb) (0) 75 | #define PKTCLEN(skb) (0) 76 | #define PKTCFLAGS(skb) (0) 77 | #define PKTCSETCNT(skb, c) 78 | #define PKTCSETLEN(skb, l) 79 | #define PKTCSETFLAG(skb, fb) 80 | #define PKTCCLRFLAG(skb, fb) 81 | #define PKTCLINK(skb) PKTLINK(skb) 82 | #define PKTSETCLINK(skb, x) PKTSETLINK((skb), (x)) 83 | #define PKTISCHAINED(skb) FALSE 84 | #define FOREACH_CHAINED_PKT(skb, nskb) \ 85 | for ((nskb) = NULL; (skb) != NULL; (skb) = (nskb)) 86 | #define PKTCFREE PKTFREE 87 | #endif 88 | 89 | 90 | #endif /* _osl_h_ */ 91 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/packed_section_end.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Declare directives for structure packing. No padding will be provided 3 | * between the members of packed structures, and therefore, there is no 4 | * guarantee that structure members will be aligned. 5 | * 6 | * Declaring packed structures is compiler specific. In order to handle all 7 | * cases, packed structures should be delared as: 8 | * 9 | * #include 10 | * 11 | * typedef BWL_PRE_PACKED_STRUCT struct foobar_t { 12 | * some_struct_members; 13 | * } BWL_POST_PACKED_STRUCT foobar_t; 14 | * 15 | * #include 16 | * 17 | * 18 | * Copyright (C) 1999-2012, Broadcom Corporation 19 | * 20 | * Unless you and Broadcom execute a separate written software license 21 | * agreement governing use of this software, this software is licensed to you 22 | * under the terms of the GNU General Public License version 2 (the "GPL"), 23 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 24 | * following added to such license: 25 | * 26 | * As a special exception, the copyright holders of this software give you 27 | * permission to link this software with independent modules, and to copy and 28 | * distribute the resulting executable under terms of your choice, provided that 29 | * you also meet, for each linked independent module, the terms and conditions of 30 | * the license of that module. An independent module is a module which is not 31 | * derived from this software. The special exception does not apply to any 32 | * modifications of the software. 33 | * 34 | * Notwithstanding the above, under no circumstances may you combine this 35 | * software in any way with any other Broadcom software provided under a license 36 | * other than the GPL, without Broadcom's express prior written consent. 37 | * $Id: packed_section_end.h 241182 2011-02-17 21:50:03Z $ 38 | */ 39 | 40 | 41 | /* Error check - BWL_PACKED_SECTION is defined in packed_section_start.h 42 | * and undefined in packed_section_end.h. If it is NOT defined at this 43 | * point, then there is a missing include of packed_section_start.h. 44 | */ 45 | #ifdef BWL_PACKED_SECTION 46 | #undef BWL_PACKED_SECTION 47 | #else 48 | #error "BWL_PACKED_SECTION is NOT defined!" 49 | #endif 50 | 51 | 52 | 53 | 54 | /* Compiler-specific directives for structure packing are declared in 55 | * packed_section_start.h. This marks the end of the structure packing section, 56 | * so, undef them here. 57 | */ 58 | #undef BWL_PRE_PACKED_STRUCT 59 | #undef BWL_POST_PACKED_STRUCT 60 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/packed_section_start.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Declare directives for structure packing. No padding will be provided 3 | * between the members of packed structures, and therefore, there is no 4 | * guarantee that structure members will be aligned. 5 | * 6 | * Declaring packed structures is compiler specific. In order to handle all 7 | * cases, packed structures should be delared as: 8 | * 9 | * #include 10 | * 11 | * typedef BWL_PRE_PACKED_STRUCT struct foobar_t { 12 | * some_struct_members; 13 | * } BWL_POST_PACKED_STRUCT foobar_t; 14 | * 15 | * #include 16 | * 17 | * 18 | * Copyright (C) 1999-2012, Broadcom Corporation 19 | * 20 | * Unless you and Broadcom execute a separate written software license 21 | * agreement governing use of this software, this software is licensed to you 22 | * under the terms of the GNU General Public License version 2 (the "GPL"), 23 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 24 | * following added to such license: 25 | * 26 | * As a special exception, the copyright holders of this software give you 27 | * permission to link this software with independent modules, and to copy and 28 | * distribute the resulting executable under terms of your choice, provided that 29 | * you also meet, for each linked independent module, the terms and conditions of 30 | * the license of that module. An independent module is a module which is not 31 | * derived from this software. The special exception does not apply to any 32 | * modifications of the software. 33 | * 34 | * Notwithstanding the above, under no circumstances may you combine this 35 | * software in any way with any other Broadcom software provided under a license 36 | * other than the GPL, without Broadcom's express prior written consent. 37 | * $Id: packed_section_start.h 286783 2011-09-29 06:18:57Z $ 38 | */ 39 | 40 | 41 | /* Error check - BWL_PACKED_SECTION is defined in packed_section_start.h 42 | * and undefined in packed_section_end.h. If it is already defined at this 43 | * point, then there is a missing include of packed_section_end.h. 44 | */ 45 | #ifdef BWL_PACKED_SECTION 46 | #error "BWL_PACKED_SECTION is already defined!" 47 | #else 48 | #define BWL_PACKED_SECTION 49 | #endif 50 | 51 | 52 | 53 | 54 | /* Declare compiler-specific directives for structure packing. */ 55 | #if defined(__GNUC__) || defined(__lint) 56 | #define BWL_PRE_PACKED_STRUCT 57 | #define BWL_POST_PACKED_STRUCT __attribute__ ((packed)) 58 | #elif defined(__CC_ARM) 59 | #define BWL_PRE_PACKED_STRUCT __packed 60 | #define BWL_POST_PACKED_STRUCT 61 | #else 62 | #error "Unknown compiler!" 63 | #endif 64 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/pcicfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * pcicfg.h: PCI configuration constants and structures. 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: pcicfg.h 309193 2012-01-19 00:03:57Z $ 25 | */ 26 | 27 | #ifndef _h_pcicfg_ 28 | #define _h_pcicfg_ 29 | 30 | /* A structure for the config registers is nice, but in most 31 | * systems the config space is not memory mapped, so we need 32 | * field offsetts. :-( 33 | */ 34 | #define PCI_CFG_VID 0 35 | #define PCI_CFG_DID 2 36 | #define PCI_CFG_CMD 4 37 | #define PCI_CFG_STAT 6 38 | #define PCI_CFG_REV 8 39 | #define PCI_CFG_PROGIF 9 40 | #define PCI_CFG_SUBCL 0xa 41 | #define PCI_CFG_BASECL 0xb 42 | #define PCI_CFG_CLSZ 0xc 43 | #define PCI_CFG_LATTIM 0xd 44 | #define PCI_CFG_HDR 0xe 45 | #define PCI_CFG_BIST 0xf 46 | #define PCI_CFG_BAR0 0x10 47 | #define PCI_CFG_BAR1 0x14 48 | #define PCI_CFG_BAR2 0x18 49 | #define PCI_CFG_BAR3 0x1c 50 | #define PCI_CFG_BAR4 0x20 51 | #define PCI_CFG_BAR5 0x24 52 | #define PCI_CFG_CIS 0x28 53 | #define PCI_CFG_SVID 0x2c 54 | #define PCI_CFG_SSID 0x2e 55 | #define PCI_CFG_ROMBAR 0x30 56 | #define PCI_CFG_CAPPTR 0x34 57 | #define PCI_CFG_INT 0x3c 58 | #define PCI_CFG_PIN 0x3d 59 | #define PCI_CFG_MINGNT 0x3e 60 | #define PCI_CFG_MAXLAT 0x3f 61 | #define PCI_BAR0_WIN 0x80 /* backplane addres space accessed by BAR0 */ 62 | #define PCI_BAR1_WIN 0x84 /* backplane addres space accessed by BAR1 */ 63 | #define PCI_SPROM_CONTROL 0x88 /* sprom property control */ 64 | #define PCI_BAR1_CONTROL 0x8c /* BAR1 region burst control */ 65 | #define PCI_INT_STATUS 0x90 /* PCI and other cores interrupts */ 66 | #define PCI_INT_MASK 0x94 /* mask of PCI and other cores interrupts */ 67 | #define PCI_TO_SB_MB 0x98 /* signal backplane interrupts */ 68 | #define PCI_BACKPLANE_ADDR 0xa0 /* address an arbitrary location on the system backplane */ 69 | #define PCI_BACKPLANE_DATA 0xa4 /* data at the location specified by above address */ 70 | #define PCI_CLK_CTL_ST 0xa8 /* pci config space clock control/status (>=rev14) */ 71 | #define PCI_BAR0_WIN2 0xac /* backplane addres space accessed by second 4KB of BAR0 */ 72 | #define PCI_GPIO_IN 0xb0 /* pci config space gpio input (>=rev3) */ 73 | #define PCI_GPIO_OUT 0xb4 /* pci config space gpio output (>=rev3) */ 74 | #define PCI_GPIO_OUTEN 0xb8 /* pci config space gpio output enable (>=rev3) */ 75 | 76 | #define PCI_BAR0_SHADOW_OFFSET (2 * 1024) /* bar0 + 2K accesses sprom shadow (in pci core) */ 77 | #define PCI_BAR0_SPROM_OFFSET (4 * 1024) /* bar0 + 4K accesses external sprom */ 78 | #define PCI_BAR0_PCIREGS_OFFSET (6 * 1024) /* bar0 + 6K accesses pci core registers */ 79 | #define PCI_BAR0_PCISBR_OFFSET (4 * 1024) /* pci core SB registers are at the end of the 80 | * 8KB window, so their address is the "regular" 81 | * address plus 4K 82 | */ 83 | /* 84 | * PCIE GEN2 changed some of the above locations for 85 | * Bar0WrapperBase, SecondaryBAR0Window and SecondaryBAR0WrapperBase 86 | * BAR0 maps 32K of register space 87 | */ 88 | #define PCIE2_BAR0_WIN2 0x70 /* backplane addres space accessed by second 4KB of BAR0 */ 89 | #define PCIE2_BAR0_CORE2_WIN 0x74 /* backplane addres space accessed by second 4KB of BAR0 */ 90 | #define PCIE2_BAR0_CORE2_WIN2 0x78 /* backplane addres space accessed by second 4KB of BAR0 */ 91 | 92 | #define PCI_BAR0_WINSZ (16 * 1024) /* bar0 window size Match with corerev 13 */ 93 | /* On pci corerev >= 13 and all pcie, the bar0 is now 16KB and it maps: */ 94 | #define PCI_16KB0_PCIREGS_OFFSET (8 * 1024) /* bar0 + 8K accesses pci/pcie core registers */ 95 | #define PCI_16KB0_CCREGS_OFFSET (12 * 1024) /* bar0 + 12K accesses chipc core registers */ 96 | #define PCI_16KBB0_WINSZ (16 * 1024) /* bar0 window size */ 97 | 98 | 99 | #define PCI_CONFIG_SPACE_SIZE 256 100 | #endif /* _h_pcicfg_ */ 101 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/proto/802.11_bta.h: -------------------------------------------------------------------------------- 1 | /* 2 | * BT-AMP (BlueTooth Alternate Mac and Phy) 802.11 PAL (Protocol Adaptation Layer) 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: 802.11_bta.h 294267 2011-11-04 23:41:52Z $ 25 | */ 26 | 27 | #ifndef _802_11_BTA_H_ 28 | #define _802_11_BTA_H_ 29 | 30 | #define BT_SIG_SNAP_MPROT "\xAA\xAA\x03\x00\x19\x58" 31 | 32 | /* BT-AMP 802.11 PAL Protocols */ 33 | #define BTA_PROT_L2CAP 1 34 | #define BTA_PROT_ACTIVITY_REPORT 2 35 | #define BTA_PROT_SECURITY 3 36 | #define BTA_PROT_LINK_SUPERVISION_REQUEST 4 37 | #define BTA_PROT_LINK_SUPERVISION_REPLY 5 38 | 39 | /* BT-AMP 802.11 PAL AMP_ASSOC Type IDs */ 40 | #define BTA_TYPE_ID_MAC_ADDRESS 1 41 | #define BTA_TYPE_ID_PREFERRED_CHANNELS 2 42 | #define BTA_TYPE_ID_CONNECTED_CHANNELS 3 43 | #define BTA_TYPE_ID_CAPABILITIES 4 44 | #define BTA_TYPE_ID_VERSION 5 45 | #endif /* _802_11_bta_h_ */ 46 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/proto/802.11e.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 802.11e protocol header file 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: 802.11e.h 241182 2011-02-17 21:50:03Z $ 25 | */ 26 | 27 | #ifndef _802_11e_H_ 28 | #define _802_11e_H_ 29 | 30 | #ifndef _TYPEDEFS_H_ 31 | #include 32 | #endif 33 | 34 | /* This marks the start of a packed structure section. */ 35 | #include 36 | 37 | 38 | /* WME Traffic Specification (TSPEC) element */ 39 | #define WME_TSPEC_HDR_LEN 2 /* WME TSPEC header length */ 40 | #define WME_TSPEC_BODY_OFF 2 /* WME TSPEC body offset */ 41 | 42 | #define WME_CATEGORY_CODE_OFFSET 0 /* WME Category code offset */ 43 | #define WME_ACTION_CODE_OFFSET 1 /* WME Action code offset */ 44 | #define WME_TOKEN_CODE_OFFSET 2 /* WME Token code offset */ 45 | #define WME_STATUS_CODE_OFFSET 3 /* WME Status code offset */ 46 | 47 | BWL_PRE_PACKED_STRUCT struct tsinfo { 48 | uint8 octets[3]; 49 | } BWL_POST_PACKED_STRUCT; 50 | 51 | typedef struct tsinfo tsinfo_t; 52 | 53 | /* 802.11e TSPEC IE */ 54 | typedef BWL_PRE_PACKED_STRUCT struct tspec { 55 | uint8 oui[DOT11_OUI_LEN]; /* WME_OUI */ 56 | uint8 type; /* WME_TYPE */ 57 | uint8 subtype; /* WME_SUBTYPE_TSPEC */ 58 | uint8 version; /* WME_VERSION */ 59 | tsinfo_t tsinfo; /* TS Info bit field */ 60 | uint16 nom_msdu_size; /* (Nominal or fixed) MSDU Size (bytes) */ 61 | uint16 max_msdu_size; /* Maximum MSDU Size (bytes) */ 62 | uint32 min_srv_interval; /* Minimum Service Interval (us) */ 63 | uint32 max_srv_interval; /* Maximum Service Interval (us) */ 64 | uint32 inactivity_interval; /* Inactivity Interval (us) */ 65 | uint32 suspension_interval; /* Suspension Interval (us) */ 66 | uint32 srv_start_time; /* Service Start Time (us) */ 67 | uint32 min_data_rate; /* Minimum Data Rate (bps) */ 68 | uint32 mean_data_rate; /* Mean Data Rate (bps) */ 69 | uint32 peak_data_rate; /* Peak Data Rate (bps) */ 70 | uint32 max_burst_size; /* Maximum Burst Size (bytes) */ 71 | uint32 delay_bound; /* Delay Bound (us) */ 72 | uint32 min_phy_rate; /* Minimum PHY Rate (bps) */ 73 | uint16 surplus_bw; /* Surplus Bandwidth Allowance (range 1.0-8.0) */ 74 | uint16 medium_time; /* Medium Time (32 us/s periods) */ 75 | } BWL_POST_PACKED_STRUCT tspec_t; 76 | 77 | #define WME_TSPEC_LEN (sizeof(tspec_t)) /* not including 2-bytes of header */ 78 | 79 | /* ts_info */ 80 | /* 802.1D priority is duplicated - bits 13-11 AND bits 3-1 */ 81 | #define TS_INFO_TID_SHIFT 1 /* TS info. TID shift */ 82 | #define TS_INFO_TID_MASK (0xf << TS_INFO_TID_SHIFT) /* TS info. TID mask */ 83 | #define TS_INFO_CONTENTION_SHIFT 7 /* TS info. contention shift */ 84 | #define TS_INFO_CONTENTION_MASK (0x1 << TS_INFO_CONTENTION_SHIFT) /* TS info. contention mask */ 85 | #define TS_INFO_DIRECTION_SHIFT 5 /* TS info. direction shift */ 86 | #define TS_INFO_DIRECTION_MASK (0x3 << TS_INFO_DIRECTION_SHIFT) /* TS info. direction mask */ 87 | #define TS_INFO_PSB_SHIFT 2 /* TS info. PSB bit Shift */ 88 | #define TS_INFO_PSB_MASK (1 << TS_INFO_PSB_SHIFT) /* TS info. PSB mask */ 89 | #define TS_INFO_UPLINK (0 << TS_INFO_DIRECTION_SHIFT) /* TS info. uplink */ 90 | #define TS_INFO_DOWNLINK (1 << TS_INFO_DIRECTION_SHIFT) /* TS info. downlink */ 91 | #define TS_INFO_BIDIRECTIONAL (3 << TS_INFO_DIRECTION_SHIFT) /* TS info. bidirectional */ 92 | #define TS_INFO_USER_PRIO_SHIFT 3 /* TS info. user priority shift */ 93 | /* TS info. user priority mask */ 94 | #define TS_INFO_USER_PRIO_MASK (0x7 << TS_INFO_USER_PRIO_SHIFT) 95 | 96 | /* Macro to get/set bit(s) field in TSINFO */ 97 | #define WLC_CAC_GET_TID(pt) ((((pt).octets[0]) & TS_INFO_TID_MASK) >> TS_INFO_TID_SHIFT) 98 | #define WLC_CAC_GET_DIR(pt) ((((pt).octets[0]) & \ 99 | TS_INFO_DIRECTION_MASK) >> TS_INFO_DIRECTION_SHIFT) 100 | #define WLC_CAC_GET_PSB(pt) ((((pt).octets[1]) & TS_INFO_PSB_MASK) >> TS_INFO_PSB_SHIFT) 101 | #define WLC_CAC_GET_USER_PRIO(pt) ((((pt).octets[1]) & \ 102 | TS_INFO_USER_PRIO_MASK) >> TS_INFO_USER_PRIO_SHIFT) 103 | 104 | #define WLC_CAC_SET_TID(pt, id) ((((pt).octets[0]) & (~TS_INFO_TID_MASK)) | \ 105 | ((id) << TS_INFO_TID_SHIFT)) 106 | #define WLC_CAC_SET_USER_PRIO(pt, prio) ((((pt).octets[0]) & (~TS_INFO_USER_PRIO_MASK)) | \ 107 | ((prio) << TS_INFO_USER_PRIO_SHIFT)) 108 | 109 | /* 802.11e QBSS Load IE */ 110 | #define QBSS_LOAD_IE_LEN 5 /* QBSS Load IE length */ 111 | #define QBSS_LOAD_AAC_OFF 3 /* AAC offset in IE */ 112 | 113 | #define CAC_ADDTS_RESP_TIMEOUT 300 /* default ADDTS response timeout in ms */ 114 | 115 | /* 802.11e ADDTS status code */ 116 | #define DOT11E_STATUS_ADMISSION_ACCEPTED 0 /* TSPEC Admission accepted status */ 117 | #define DOT11E_STATUS_ADDTS_INVALID_PARAM 1 /* TSPEC invalid parameter status */ 118 | #define DOT11E_STATUS_ADDTS_REFUSED_NSBW 3 /* ADDTS refused (non-sufficient BW) */ 119 | #define DOT11E_STATUS_ADDTS_REFUSED_AWHILE 47 /* ADDTS refused but could retry later */ 120 | 121 | /* 802.11e DELTS status code */ 122 | #define DOT11E_STATUS_QSTA_LEAVE_QBSS 36 /* STA leave QBSS */ 123 | #define DOT11E_STATUS_END_TS 37 /* END TS */ 124 | #define DOT11E_STATUS_UNKNOWN_TS 38 /* UNKNOWN TS */ 125 | #define DOT11E_STATUS_QSTA_REQ_TIMEOUT 39 /* STA ADDTS request timeout */ 126 | 127 | 128 | /* This marks the end of a packed structure section. */ 129 | #include 130 | 131 | #endif /* _802_11e_CAC_H_ */ 132 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/proto/802.1d.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2012, Broadcom Corporation 3 | * 4 | * Unless you and Broadcom execute a separate written software license 5 | * agreement governing use of this software, this software is licensed to you 6 | * under the terms of the GNU General Public License version 2 (the "GPL"), 7 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 8 | * following added to such license: 9 | * 10 | * As a special exception, the copyright holders of this software give you 11 | * permission to link this software with independent modules, and to copy and 12 | * distribute the resulting executable under terms of your choice, provided that 13 | * you also meet, for each linked independent module, the terms and conditions of 14 | * the license of that module. An independent module is a module which is not 15 | * derived from this software. The special exception does not apply to any 16 | * modifications of the software. 17 | * 18 | * Notwithstanding the above, under no circumstances may you combine this 19 | * software in any way with any other Broadcom software provided under a license 20 | * other than the GPL, without Broadcom's express prior written consent. 21 | * 22 | * Fundamental types and constants relating to 802.1D 23 | * 24 | * $Id: 802.1d.h 241182 2011-02-17 21:50:03Z $ 25 | */ 26 | 27 | #ifndef _802_1_D_ 28 | #define _802_1_D_ 29 | 30 | /* 802.1D priority defines */ 31 | #define PRIO_8021D_NONE 2 /* None = - */ 32 | #define PRIO_8021D_BK 1 /* BK - Background */ 33 | #define PRIO_8021D_BE 0 /* BE - Best-effort */ 34 | #define PRIO_8021D_EE 3 /* EE - Excellent-effort */ 35 | #define PRIO_8021D_CL 4 /* CL - Controlled Load */ 36 | #define PRIO_8021D_VI 5 /* Vi - Video */ 37 | #define PRIO_8021D_VO 6 /* Vo - Voice */ 38 | #define PRIO_8021D_NC 7 /* NC - Network Control */ 39 | #define MAXPRIO 7 /* 0-7 */ 40 | #define NUMPRIO (MAXPRIO + 1) 41 | 42 | #define ALLPRIO -1 /* All prioirty */ 43 | 44 | /* Converts prio to precedence since the numerical value of 45 | * PRIO_8021D_BE and PRIO_8021D_NONE are swapped. 46 | */ 47 | #define PRIO2PREC(prio) \ 48 | (((prio) == PRIO_8021D_NONE || (prio) == PRIO_8021D_BE) ? ((prio^2)) : (prio)) 49 | 50 | #endif /* _802_1_D__ */ 51 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/proto/bcmeth.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Broadcom Ethernettype protocol definitions 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: bcmeth.h 294352 2011-11-06 19:23:00Z $ 25 | */ 26 | 27 | /* 28 | * Broadcom Ethernet protocol defines 29 | */ 30 | 31 | #ifndef _BCMETH_H_ 32 | #define _BCMETH_H_ 33 | 34 | #ifndef _TYPEDEFS_H_ 35 | #include 36 | #endif 37 | 38 | /* This marks the start of a packed structure section. */ 39 | #include 40 | 41 | /* ETHER_TYPE_BRCM is defined in ethernet.h */ 42 | 43 | /* 44 | * Following the 2byte BRCM ether_type is a 16bit BRCM subtype field 45 | * in one of two formats: (only subtypes 32768-65535 are in use now) 46 | * 47 | * subtypes 0-32767: 48 | * 8 bit subtype (0-127) 49 | * 8 bit length in bytes (0-255) 50 | * 51 | * subtypes 32768-65535: 52 | * 16 bit big-endian subtype 53 | * 16 bit big-endian length in bytes (0-65535) 54 | * 55 | * length is the number of additional bytes beyond the 4 or 6 byte header 56 | * 57 | * Reserved values: 58 | * 0 reserved 59 | * 5-15 reserved for iLine protocol assignments 60 | * 17-126 reserved, assignable 61 | * 127 reserved 62 | * 32768 reserved 63 | * 32769-65534 reserved, assignable 64 | * 65535 reserved 65 | */ 66 | 67 | /* 68 | * While adding the subtypes and their specific processing code make sure 69 | * bcmeth_bcm_hdr_t is the first data structure in the user specific data structure definition 70 | */ 71 | 72 | #define BCMILCP_SUBTYPE_RATE 1 73 | #define BCMILCP_SUBTYPE_LINK 2 74 | #define BCMILCP_SUBTYPE_CSA 3 75 | #define BCMILCP_SUBTYPE_LARQ 4 76 | #define BCMILCP_SUBTYPE_VENDOR 5 77 | #define BCMILCP_SUBTYPE_FLH 17 78 | 79 | #define BCMILCP_SUBTYPE_VENDOR_LONG 32769 80 | #define BCMILCP_SUBTYPE_CERT 32770 81 | #define BCMILCP_SUBTYPE_SES 32771 82 | 83 | 84 | #define BCMILCP_BCM_SUBTYPE_RESERVED 0 85 | #define BCMILCP_BCM_SUBTYPE_EVENT 1 86 | #define BCMILCP_BCM_SUBTYPE_SES 2 87 | /* 88 | * The EAPOL type is not used anymore. Instead EAPOL messages are now embedded 89 | * within BCMILCP_BCM_SUBTYPE_EVENT type messages 90 | */ 91 | /* #define BCMILCP_BCM_SUBTYPE_EAPOL 3 */ 92 | #define BCMILCP_BCM_SUBTYPE_DPT 4 93 | 94 | #define BCMILCP_BCM_SUBTYPEHDR_MINLENGTH 8 95 | #define BCMILCP_BCM_SUBTYPEHDR_VERSION 0 96 | 97 | /* These fields are stored in network order */ 98 | typedef BWL_PRE_PACKED_STRUCT struct bcmeth_hdr 99 | { 100 | uint16 subtype; /* Vendor specific..32769 */ 101 | uint16 length; 102 | uint8 version; /* Version is 0 */ 103 | uint8 oui[3]; /* Broadcom OUI */ 104 | /* user specific Data */ 105 | uint16 usr_subtype; 106 | } BWL_POST_PACKED_STRUCT bcmeth_hdr_t; 107 | 108 | 109 | /* This marks the end of a packed structure section. */ 110 | #include 111 | 112 | #endif /* _BCMETH_H_ */ 113 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/proto/bcmip.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2012, Broadcom Corporation 3 | * 4 | * Unless you and Broadcom execute a separate written software license 5 | * agreement governing use of this software, this software is licensed to you 6 | * under the terms of the GNU General Public License version 2 (the "GPL"), 7 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 8 | * following added to such license: 9 | * 10 | * As a special exception, the copyright holders of this software give you 11 | * permission to link this software with independent modules, and to copy and 12 | * distribute the resulting executable under terms of your choice, provided that 13 | * you also meet, for each linked independent module, the terms and conditions of 14 | * the license of that module. An independent module is a module which is not 15 | * derived from this software. The special exception does not apply to any 16 | * modifications of the software. 17 | * 18 | * Notwithstanding the above, under no circumstances may you combine this 19 | * software in any way with any other Broadcom software provided under a license 20 | * other than the GPL, without Broadcom's express prior written consent. 21 | * 22 | * Fundamental constants relating to IP Protocol 23 | * 24 | * $Id: bcmip.h 290206 2011-10-17 19:13:51Z $ 25 | */ 26 | 27 | #ifndef _bcmip_h_ 28 | #define _bcmip_h_ 29 | 30 | #ifndef _TYPEDEFS_H_ 31 | #include 32 | #endif 33 | 34 | /* This marks the start of a packed structure section. */ 35 | #include 36 | 37 | 38 | /* IPV4 and IPV6 common */ 39 | #define IP_VER_OFFSET 0x0 /* offset to version field */ 40 | #define IP_VER_MASK 0xf0 /* version mask */ 41 | #define IP_VER_SHIFT 4 /* version shift */ 42 | #define IP_VER_4 4 /* version number for IPV4 */ 43 | #define IP_VER_6 6 /* version number for IPV6 */ 44 | 45 | #define IP_VER(ip_body) \ 46 | ((((uint8 *)(ip_body))[IP_VER_OFFSET] & IP_VER_MASK) >> IP_VER_SHIFT) 47 | 48 | #define IP_PROT_ICMP 0x1 /* ICMP protocol */ 49 | #define IP_PROT_IGMP 0x2 /* IGMP protocol */ 50 | #define IP_PROT_TCP 0x6 /* TCP protocol */ 51 | #define IP_PROT_UDP 0x11 /* UDP protocol type */ 52 | #define IP_PROT_ICMP6 0x3a /* ICMPv6 protocol type */ 53 | 54 | /* IPV4 field offsets */ 55 | #define IPV4_VER_HL_OFFSET 0 /* version and ihl byte offset */ 56 | #define IPV4_TOS_OFFSET 1 /* type of service offset */ 57 | #define IPV4_PKTLEN_OFFSET 2 /* packet length offset */ 58 | #define IPV4_PKTFLAG_OFFSET 6 /* more-frag,dont-frag flag offset */ 59 | #define IPV4_PROT_OFFSET 9 /* protocol type offset */ 60 | #define IPV4_CHKSUM_OFFSET 10 /* IP header checksum offset */ 61 | #define IPV4_SRC_IP_OFFSET 12 /* src IP addr offset */ 62 | #define IPV4_DEST_IP_OFFSET 16 /* dest IP addr offset */ 63 | #define IPV4_OPTIONS_OFFSET 20 /* IP options offset */ 64 | 65 | /* IPV4 field decodes */ 66 | #define IPV4_VER_MASK 0xf0 /* IPV4 version mask */ 67 | #define IPV4_VER_SHIFT 4 /* IPV4 version shift */ 68 | 69 | #define IPV4_HLEN_MASK 0x0f /* IPV4 header length mask */ 70 | #define IPV4_HLEN(ipv4_body) (4 * (((uint8 *)(ipv4_body))[IPV4_VER_HL_OFFSET] & IPV4_HLEN_MASK)) 71 | 72 | #define IPV4_ADDR_LEN 4 /* IPV4 address length */ 73 | 74 | #define IPV4_ADDR_NULL(a) ((((uint8 *)(a))[0] | ((uint8 *)(a))[1] | \ 75 | ((uint8 *)(a))[2] | ((uint8 *)(a))[3]) == 0) 76 | 77 | #define IPV4_ADDR_BCAST(a) ((((uint8 *)(a))[0] & ((uint8 *)(a))[1] & \ 78 | ((uint8 *)(a))[2] & ((uint8 *)(a))[3]) == 0xff) 79 | 80 | #define IPV4_TOS_DSCP_MASK 0xfc /* DiffServ codepoint mask */ 81 | #define IPV4_TOS_DSCP_SHIFT 2 /* DiffServ codepoint shift */ 82 | 83 | #define IPV4_TOS(ipv4_body) (((uint8 *)(ipv4_body))[IPV4_TOS_OFFSET]) 84 | 85 | #define IPV4_TOS_PREC_MASK 0xe0 /* Historical precedence mask */ 86 | #define IPV4_TOS_PREC_SHIFT 5 /* Historical precedence shift */ 87 | 88 | #define IPV4_TOS_LOWDELAY 0x10 /* Lowest delay requested */ 89 | #define IPV4_TOS_THROUGHPUT 0x8 /* Best throughput requested */ 90 | #define IPV4_TOS_RELIABILITY 0x4 /* Most reliable delivery requested */ 91 | 92 | #define IPV4_PROT(ipv4_body) (((uint8 *)(ipv4_body))[IPV4_PROT_OFFSET]) 93 | 94 | #define IPV4_FRAG_RESV 0x8000 /* Reserved */ 95 | #define IPV4_FRAG_DONT 0x4000 /* Don't fragment */ 96 | #define IPV4_FRAG_MORE 0x2000 /* More fragments */ 97 | #define IPV4_FRAG_OFFSET_MASK 0x1fff /* Fragment offset */ 98 | 99 | #define IPV4_ADDR_STR_LEN 16 /* Max IP address length in string format */ 100 | 101 | /* IPV4 packet formats */ 102 | BWL_PRE_PACKED_STRUCT struct ipv4_addr { 103 | uint8 addr[IPV4_ADDR_LEN]; 104 | } BWL_POST_PACKED_STRUCT; 105 | 106 | BWL_PRE_PACKED_STRUCT struct ipv4_hdr { 107 | uint8 version_ihl; /* Version and Internet Header Length */ 108 | uint8 tos; /* Type Of Service */ 109 | uint16 tot_len; /* Number of bytes in packet (max 65535) */ 110 | uint16 id; 111 | uint16 frag; /* 3 flag bits and fragment offset */ 112 | uint8 ttl; /* Time To Live */ 113 | uint8 prot; /* Protocol */ 114 | uint16 hdr_chksum; /* IP header checksum */ 115 | uint8 src_ip[IPV4_ADDR_LEN]; /* Source IP Address */ 116 | uint8 dst_ip[IPV4_ADDR_LEN]; /* Destination IP Address */ 117 | } BWL_POST_PACKED_STRUCT; 118 | 119 | /* IPV6 field offsets */ 120 | #define IPV6_PAYLOAD_LEN_OFFSET 4 /* payload length offset */ 121 | #define IPV6_NEXT_HDR_OFFSET 6 /* next header/protocol offset */ 122 | #define IPV6_HOP_LIMIT_OFFSET 7 /* hop limit offset */ 123 | #define IPV6_SRC_IP_OFFSET 8 /* src IP addr offset */ 124 | #define IPV6_DEST_IP_OFFSET 24 /* dst IP addr offset */ 125 | 126 | /* IPV6 field decodes */ 127 | #define IPV6_TRAFFIC_CLASS(ipv6_body) \ 128 | (((((uint8 *)(ipv6_body))[0] & 0x0f) << 4) | \ 129 | ((((uint8 *)(ipv6_body))[1] & 0xf0) >> 4)) 130 | 131 | #define IPV6_FLOW_LABEL(ipv6_body) \ 132 | (((((uint8 *)(ipv6_body))[1] & 0x0f) << 16) | \ 133 | (((uint8 *)(ipv6_body))[2] << 8) | \ 134 | (((uint8 *)(ipv6_body))[3])) 135 | 136 | #define IPV6_PAYLOAD_LEN(ipv6_body) \ 137 | ((((uint8 *)(ipv6_body))[IPV6_PAYLOAD_LEN_OFFSET + 0] << 8) | \ 138 | ((uint8 *)(ipv6_body))[IPV6_PAYLOAD_LEN_OFFSET + 1]) 139 | 140 | #define IPV6_NEXT_HDR(ipv6_body) \ 141 | (((uint8 *)(ipv6_body))[IPV6_NEXT_HDR_OFFSET]) 142 | 143 | #define IPV6_PROT(ipv6_body) IPV6_NEXT_HDR(ipv6_body) 144 | 145 | #define IPV6_ADDR_LEN 16 /* IPV6 address length */ 146 | 147 | /* IPV4 TOS or IPV6 Traffic Classifier or 0 */ 148 | #define IP_TOS46(ip_body) \ 149 | (IP_VER(ip_body) == IP_VER_4 ? IPV4_TOS(ip_body) : \ 150 | IP_VER(ip_body) == IP_VER_6 ? IPV6_TRAFFIC_CLASS(ip_body) : 0) 151 | 152 | /* IPV6 extension headers (options) */ 153 | #define IPV6_EXTHDR_HOP 0 154 | #define IPV6_EXTHDR_ROUTING 43 155 | #define IPV6_EXTHDR_FRAGMENT 44 156 | #define IPV6_EXTHDR_AUTH 51 157 | #define IPV6_EXTHDR_NONE 59 158 | #define IPV6_EXTHDR_DEST 60 159 | 160 | #define IPV6_EXTHDR(prot) (((prot) == IPV6_EXTHDR_HOP) || \ 161 | ((prot) == IPV6_EXTHDR_ROUTING) || \ 162 | ((prot) == IPV6_EXTHDR_FRAGMENT) || \ 163 | ((prot) == IPV6_EXTHDR_AUTH) || \ 164 | ((prot) == IPV6_EXTHDR_NONE) || \ 165 | ((prot) == IPV6_EXTHDR_DEST)) 166 | 167 | #define IPV6_MIN_HLEN 40 168 | 169 | #define IPV6_EXTHDR_LEN(eh) ((((struct ipv6_exthdr *)(eh))->hdrlen + 1) << 3) 170 | 171 | BWL_PRE_PACKED_STRUCT struct ipv6_exthdr { 172 | uint8 nexthdr; 173 | uint8 hdrlen; 174 | } BWL_POST_PACKED_STRUCT; 175 | 176 | BWL_PRE_PACKED_STRUCT struct ipv6_exthdr_frag { 177 | uint8 nexthdr; 178 | uint8 rsvd; 179 | uint16 frag_off; 180 | uint32 ident; 181 | } BWL_POST_PACKED_STRUCT; 182 | 183 | static INLINE int32 184 | ipv6_exthdr_len(uint8 *h, uint8 *proto) 185 | { 186 | uint16 len = 0, hlen; 187 | struct ipv6_exthdr *eh = (struct ipv6_exthdr *)h; 188 | 189 | while (IPV6_EXTHDR(eh->nexthdr)) { 190 | if (eh->nexthdr == IPV6_EXTHDR_NONE) 191 | return -1; 192 | else if (eh->nexthdr == IPV6_EXTHDR_FRAGMENT) 193 | hlen = 8; 194 | else if (eh->nexthdr == IPV6_EXTHDR_AUTH) 195 | hlen = (eh->hdrlen + 2) << 2; 196 | else 197 | hlen = IPV6_EXTHDR_LEN(eh); 198 | 199 | len += hlen; 200 | eh = (struct ipv6_exthdr *)(h + len); 201 | } 202 | 203 | *proto = eh->nexthdr; 204 | return len; 205 | } 206 | 207 | /* This marks the end of a packed structure section. */ 208 | #include 209 | 210 | #endif /* _bcmip_h_ */ 211 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/proto/eapol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 802.1x EAPOL definitions 3 | * 4 | * See 5 | * IEEE Std 802.1X-2001 6 | * IEEE 802.1X RADIUS Usage Guidelines 7 | * 8 | * Copyright (C) 2002 Broadcom Corporation 9 | * 10 | * $Id: eapol.h 241182 2011-02-17 21:50:03Z $ 11 | */ 12 | 13 | #ifndef _eapol_h_ 14 | #define _eapol_h_ 15 | 16 | #ifndef _TYPEDEFS_H_ 17 | #include 18 | #endif 19 | 20 | /* This marks the start of a packed structure section. */ 21 | #include 22 | 23 | #include 24 | 25 | /* EAPOL for 802.3/Ethernet */ 26 | typedef BWL_PRE_PACKED_STRUCT struct { 27 | struct ether_header eth; /* 802.3/Ethernet header */ 28 | unsigned char version; /* EAPOL protocol version */ 29 | unsigned char type; /* EAPOL type */ 30 | unsigned short length; /* Length of body */ 31 | unsigned char body[1]; /* Body (optional) */ 32 | } BWL_POST_PACKED_STRUCT eapol_header_t; 33 | 34 | #define EAPOL_HEADER_LEN 18 35 | 36 | typedef struct { 37 | unsigned char version; /* EAPOL protocol version */ 38 | unsigned char type; /* EAPOL type */ 39 | unsigned short length; /* Length of body */ 40 | } eapol_hdr_t; 41 | 42 | #define EAPOL_HDR_LEN 4 43 | 44 | /* EAPOL version */ 45 | #define WPA2_EAPOL_VERSION 2 46 | #define WPA_EAPOL_VERSION 1 47 | #define LEAP_EAPOL_VERSION 1 48 | #define SES_EAPOL_VERSION 1 49 | 50 | /* EAPOL types */ 51 | #define EAP_PACKET 0 52 | #define EAPOL_START 1 53 | #define EAPOL_LOGOFF 2 54 | #define EAPOL_KEY 3 55 | #define EAPOL_ASF 4 56 | 57 | /* EAPOL-Key types */ 58 | #define EAPOL_RC4_KEY 1 59 | #define EAPOL_WPA2_KEY 2 /* 802.11i/WPA2 */ 60 | #define EAPOL_WPA_KEY 254 /* WPA */ 61 | 62 | /* RC4 EAPOL-Key header field sizes */ 63 | #define EAPOL_KEY_REPLAY_LEN 8 64 | #define EAPOL_KEY_IV_LEN 16 65 | #define EAPOL_KEY_SIG_LEN 16 66 | 67 | /* RC4 EAPOL-Key */ 68 | typedef BWL_PRE_PACKED_STRUCT struct { 69 | unsigned char type; /* Key Descriptor Type */ 70 | unsigned short length; /* Key Length (unaligned) */ 71 | unsigned char replay[EAPOL_KEY_REPLAY_LEN]; /* Replay Counter */ 72 | unsigned char iv[EAPOL_KEY_IV_LEN]; /* Key IV */ 73 | unsigned char index; /* Key Flags & Index */ 74 | unsigned char signature[EAPOL_KEY_SIG_LEN]; /* Key Signature */ 75 | unsigned char key[1]; /* Key (optional) */ 76 | } BWL_POST_PACKED_STRUCT eapol_key_header_t; 77 | 78 | #define EAPOL_KEY_HEADER_LEN 44 79 | 80 | /* RC4 EAPOL-Key flags */ 81 | #define EAPOL_KEY_FLAGS_MASK 0x80 82 | #define EAPOL_KEY_BROADCAST 0 83 | #define EAPOL_KEY_UNICAST 0x80 84 | 85 | /* RC4 EAPOL-Key index */ 86 | #define EAPOL_KEY_INDEX_MASK 0x7f 87 | 88 | /* WPA/802.11i/WPA2 EAPOL-Key header field sizes */ 89 | #define EAPOL_WPA_KEY_REPLAY_LEN 8 90 | #define EAPOL_WPA_KEY_NONCE_LEN 32 91 | #define EAPOL_WPA_KEY_IV_LEN 16 92 | #define EAPOL_WPA_KEY_RSC_LEN 8 93 | #define EAPOL_WPA_KEY_ID_LEN 8 94 | #define EAPOL_WPA_KEY_MIC_LEN 16 95 | #define EAPOL_WPA_KEY_DATA_LEN (EAPOL_WPA_MAX_KEY_SIZE + AKW_BLOCK_LEN) 96 | #define EAPOL_WPA_MAX_KEY_SIZE 32 97 | 98 | /* WPA EAPOL-Key */ 99 | typedef BWL_PRE_PACKED_STRUCT struct { 100 | unsigned char type; /* Key Descriptor Type */ 101 | unsigned short key_info; /* Key Information (unaligned) */ 102 | unsigned short key_len; /* Key Length (unaligned) */ 103 | unsigned char replay[EAPOL_WPA_KEY_REPLAY_LEN]; /* Replay Counter */ 104 | unsigned char nonce[EAPOL_WPA_KEY_NONCE_LEN]; /* Nonce */ 105 | unsigned char iv[EAPOL_WPA_KEY_IV_LEN]; /* Key IV */ 106 | unsigned char rsc[EAPOL_WPA_KEY_RSC_LEN]; /* Key RSC */ 107 | unsigned char id[EAPOL_WPA_KEY_ID_LEN]; /* WPA:Key ID, 802.11i/WPA2: Reserved */ 108 | unsigned char mic[EAPOL_WPA_KEY_MIC_LEN]; /* Key MIC */ 109 | unsigned short data_len; /* Key Data Length */ 110 | unsigned char data[EAPOL_WPA_KEY_DATA_LEN]; /* Key data */ 111 | } BWL_POST_PACKED_STRUCT eapol_wpa_key_header_t; 112 | 113 | #define EAPOL_WPA_KEY_LEN 95 114 | 115 | /* WPA/802.11i/WPA2 KEY KEY_INFO bits */ 116 | #define WPA_KEY_DESC_V1 0x01 117 | #define WPA_KEY_DESC_V2 0x02 118 | #define WPA_KEY_DESC_V3 0x03 119 | #define WPA_KEY_PAIRWISE 0x08 120 | #define WPA_KEY_INSTALL 0x40 121 | #define WPA_KEY_ACK 0x80 122 | #define WPA_KEY_MIC 0x100 123 | #define WPA_KEY_SECURE 0x200 124 | #define WPA_KEY_ERROR 0x400 125 | #define WPA_KEY_REQ 0x800 126 | 127 | #define WPA_KEY_DESC_V2_OR_V3 WPA_KEY_DESC_V2 128 | 129 | /* WPA-only KEY KEY_INFO bits */ 130 | #define WPA_KEY_INDEX_0 0x00 131 | #define WPA_KEY_INDEX_1 0x10 132 | #define WPA_KEY_INDEX_2 0x20 133 | #define WPA_KEY_INDEX_3 0x30 134 | #define WPA_KEY_INDEX_MASK 0x30 135 | #define WPA_KEY_INDEX_SHIFT 0x04 136 | 137 | /* 802.11i/WPA2-only KEY KEY_INFO bits */ 138 | #define WPA_KEY_ENCRYPTED_DATA 0x1000 139 | 140 | /* Key Data encapsulation */ 141 | typedef BWL_PRE_PACKED_STRUCT struct { 142 | uint8 type; 143 | uint8 length; 144 | uint8 oui[3]; 145 | uint8 subtype; 146 | uint8 data[1]; 147 | } BWL_POST_PACKED_STRUCT eapol_wpa2_encap_data_t; 148 | 149 | #define EAPOL_WPA2_ENCAP_DATA_HDR_LEN 6 150 | 151 | #define WPA2_KEY_DATA_SUBTYPE_GTK 1 152 | #define WPA2_KEY_DATA_SUBTYPE_STAKEY 2 153 | #define WPA2_KEY_DATA_SUBTYPE_MAC 3 154 | #define WPA2_KEY_DATA_SUBTYPE_PMKID 4 155 | #define WPA2_KEY_DATA_SUBTYPE_IGTK 9 156 | 157 | /* GTK encapsulation */ 158 | typedef BWL_PRE_PACKED_STRUCT struct { 159 | uint8 flags; 160 | uint8 reserved; 161 | uint8 gtk[EAPOL_WPA_MAX_KEY_SIZE]; 162 | } BWL_POST_PACKED_STRUCT eapol_wpa2_key_gtk_encap_t; 163 | 164 | #define EAPOL_WPA2_KEY_GTK_ENCAP_HDR_LEN 2 165 | 166 | #define WPA2_GTK_INDEX_MASK 0x03 167 | #define WPA2_GTK_INDEX_SHIFT 0x00 168 | 169 | #define WPA2_GTK_TRANSMIT 0x04 170 | 171 | /* IGTK encapsulation */ 172 | typedef BWL_PRE_PACKED_STRUCT struct { 173 | uint16 key_id; 174 | uint8 ipn[6]; 175 | uint8 key[EAPOL_WPA_MAX_KEY_SIZE]; 176 | } BWL_POST_PACKED_STRUCT eapol_wpa2_key_igtk_encap_t; 177 | 178 | #define EAPOL_WPA2_KEY_IGTK_ENCAP_HDR_LEN 8 179 | 180 | /* STAKey encapsulation */ 181 | typedef BWL_PRE_PACKED_STRUCT struct { 182 | uint8 reserved[2]; 183 | uint8 mac[ETHER_ADDR_LEN]; 184 | uint8 stakey[EAPOL_WPA_MAX_KEY_SIZE]; 185 | } BWL_POST_PACKED_STRUCT eapol_wpa2_key_stakey_encap_t; 186 | 187 | #define WPA2_KEY_DATA_PAD 0xdd 188 | 189 | 190 | /* This marks the end of a packed structure section. */ 191 | #include 192 | 193 | #endif /* _eapol_h_ */ 194 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/proto/ethernet.h: -------------------------------------------------------------------------------- 1 | /* 2 | * From FreeBSD 2.2.7: Fundamental constants relating to ethernet. 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: ethernet.h 309193 2012-01-19 00:03:57Z $ 25 | */ 26 | 27 | #ifndef _NET_ETHERNET_H_ /* use native BSD ethernet.h when available */ 28 | #define _NET_ETHERNET_H_ 29 | 30 | #ifndef _TYPEDEFS_H_ 31 | #include "typedefs.h" 32 | #endif 33 | 34 | /* This marks the start of a packed structure section. */ 35 | #include 36 | 37 | 38 | /* 39 | * The number of bytes in an ethernet (MAC) address. 40 | */ 41 | #define ETHER_ADDR_LEN 6 42 | 43 | /* 44 | * The number of bytes in the type field. 45 | */ 46 | #define ETHER_TYPE_LEN 2 47 | 48 | /* 49 | * The number of bytes in the trailing CRC field. 50 | */ 51 | #define ETHER_CRC_LEN 4 52 | 53 | /* 54 | * The length of the combined header. 55 | */ 56 | #define ETHER_HDR_LEN (ETHER_ADDR_LEN * 2 + ETHER_TYPE_LEN) 57 | 58 | /* 59 | * The minimum packet length. 60 | */ 61 | #define ETHER_MIN_LEN 64 62 | 63 | /* 64 | * The minimum packet user data length. 65 | */ 66 | #define ETHER_MIN_DATA 46 67 | 68 | /* 69 | * The maximum packet length. 70 | */ 71 | #define ETHER_MAX_LEN 1518 72 | 73 | /* 74 | * The maximum packet user data length. 75 | */ 76 | #define ETHER_MAX_DATA 1500 77 | 78 | /* ether types */ 79 | #define ETHER_TYPE_MIN 0x0600 /* Anything less than MIN is a length */ 80 | #define ETHER_TYPE_IP 0x0800 /* IP */ 81 | #define ETHER_TYPE_ARP 0x0806 /* ARP */ 82 | #define ETHER_TYPE_8021Q 0x8100 /* 802.1Q */ 83 | #define ETHER_TYPE_IPV6 0x86dd /* IPv6 */ 84 | #define ETHER_TYPE_BRCM 0x886c /* Broadcom Corp. */ 85 | #define ETHER_TYPE_802_1X 0x888e /* 802.1x */ 86 | #define ETHER_TYPE_802_1X_PREAUTH 0x88c7 /* 802.1x preauthentication */ 87 | #define ETHER_TYPE_WAI 0x88b4 /* WAI */ 88 | #define ETHER_TYPE_89_0D 0x890d /* 89-0d frame for TDLS */ 89 | 90 | #define ETHER_TYPE_IPV6 0x86dd /* IPV6 */ 91 | 92 | /* Broadcom subtype follows ethertype; First 2 bytes are reserved; Next 2 are subtype; */ 93 | #define ETHER_BRCM_SUBTYPE_LEN 4 /* Broadcom 4 byte subtype */ 94 | 95 | /* ether header */ 96 | #define ETHER_DEST_OFFSET (0 * ETHER_ADDR_LEN) /* dest address offset */ 97 | #define ETHER_SRC_OFFSET (1 * ETHER_ADDR_LEN) /* src address offset */ 98 | #define ETHER_TYPE_OFFSET (2 * ETHER_ADDR_LEN) /* ether type offset */ 99 | 100 | /* 101 | * A macro to validate a length with 102 | */ 103 | #define ETHER_IS_VALID_LEN(foo) \ 104 | ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN) 105 | 106 | #define ETHER_FILL_MCAST_ADDR_FROM_IP(ea, mgrp_ip) { \ 107 | ((uint8 *)ea)[0] = 0x01; \ 108 | ((uint8 *)ea)[1] = 0x00; \ 109 | ((uint8 *)ea)[2] = 0x5e; \ 110 | ((uint8 *)ea)[3] = ((mgrp_ip) >> 16) & 0x7f; \ 111 | ((uint8 *)ea)[4] = ((mgrp_ip) >> 8) & 0xff; \ 112 | ((uint8 *)ea)[5] = ((mgrp_ip) >> 0) & 0xff; \ 113 | } 114 | 115 | #ifndef __INCif_etherh /* Quick and ugly hack for VxWorks */ 116 | /* 117 | * Structure of a 10Mb/s Ethernet header. 118 | */ 119 | BWL_PRE_PACKED_STRUCT struct ether_header { 120 | uint8 ether_dhost[ETHER_ADDR_LEN]; 121 | uint8 ether_shost[ETHER_ADDR_LEN]; 122 | uint16 ether_type; 123 | } BWL_POST_PACKED_STRUCT; 124 | 125 | /* 126 | * Structure of a 48-bit Ethernet address. 127 | */ 128 | BWL_PRE_PACKED_STRUCT struct ether_addr { 129 | uint8 octet[ETHER_ADDR_LEN]; 130 | } BWL_POST_PACKED_STRUCT; 131 | #endif /* !__INCif_etherh Quick and ugly hack for VxWorks */ 132 | 133 | /* 134 | * Takes a pointer, set, test, clear, toggle locally admininistered 135 | * address bit in the 48-bit Ethernet address. 136 | */ 137 | #define ETHER_SET_LOCALADDR(ea) (((uint8 *)(ea))[0] = (((uint8 *)(ea))[0] | 2)) 138 | #define ETHER_IS_LOCALADDR(ea) (((uint8 *)(ea))[0] & 2) 139 | #define ETHER_CLR_LOCALADDR(ea) (((uint8 *)(ea))[0] = (((uint8 *)(ea))[0] & 0xfd)) 140 | #define ETHER_TOGGLE_LOCALADDR(ea) (((uint8 *)(ea))[0] = (((uint8 *)(ea))[0] ^ 2)) 141 | 142 | /* Takes a pointer, marks unicast address bit in the MAC address */ 143 | #define ETHER_SET_UNICAST(ea) (((uint8 *)(ea))[0] = (((uint8 *)(ea))[0] & ~1)) 144 | 145 | /* 146 | * Takes a pointer, returns true if a 48-bit multicast address 147 | * (including broadcast, since it is all ones) 148 | */ 149 | #define ETHER_ISMULTI(ea) (((const uint8 *)(ea))[0] & 1) 150 | 151 | 152 | /* compare two ethernet addresses - assumes the pointers can be referenced as shorts */ 153 | #define ether_cmp(a, b) (!(((short*)(a))[0] == ((short*)(b))[0]) | \ 154 | !(((short*)(a))[1] == ((short*)(b))[1]) | \ 155 | !(((short*)(a))[2] == ((short*)(b))[2])) 156 | 157 | /* copy an ethernet address - assumes the pointers can be referenced as shorts */ 158 | #define ether_copy(s, d) { \ 159 | ((short*)(d))[0] = ((const short*)(s))[0]; \ 160 | ((short*)(d))[1] = ((const short*)(s))[1]; \ 161 | ((short*)(d))[2] = ((const short*)(s))[2]; } 162 | 163 | 164 | static const struct ether_addr ether_bcast = {{255, 255, 255, 255, 255, 255}}; 165 | static const struct ether_addr ether_null = {{0, 0, 0, 0, 0, 0}}; 166 | 167 | #define ETHER_ISBCAST(ea) ((((uint8 *)(ea))[0] & \ 168 | ((uint8 *)(ea))[1] & \ 169 | ((uint8 *)(ea))[2] & \ 170 | ((uint8 *)(ea))[3] & \ 171 | ((uint8 *)(ea))[4] & \ 172 | ((uint8 *)(ea))[5]) == 0xff) 173 | #define ETHER_ISNULLADDR(ea) ((((uint8 *)(ea))[0] | \ 174 | ((uint8 *)(ea))[1] | \ 175 | ((uint8 *)(ea))[2] | \ 176 | ((uint8 *)(ea))[3] | \ 177 | ((uint8 *)(ea))[4] | \ 178 | ((uint8 *)(ea))[5]) == 0) 179 | 180 | #define ETHER_MOVE_HDR(d, s) \ 181 | do { \ 182 | struct ether_header t; \ 183 | t = *(struct ether_header *)(s); \ 184 | *(struct ether_header *)(d) = t; \ 185 | } while (0) 186 | 187 | /* This marks the end of a packed structure section. */ 188 | #include 189 | 190 | #endif /* _NET_ETHERNET_H_ */ 191 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/proto/sdspi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SD-SPI Protocol Standard 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: sdspi.h 241182 2011-02-17 21:50:03Z $ 25 | */ 26 | #ifndef _SD_SPI_H 27 | #define _SD_SPI_H 28 | 29 | #define SPI_START_M BITFIELD_MASK(1) /* Bit [31] - Start Bit */ 30 | #define SPI_START_S 31 31 | #define SPI_DIR_M BITFIELD_MASK(1) /* Bit [30] - Direction */ 32 | #define SPI_DIR_S 30 33 | #define SPI_CMD_INDEX_M BITFIELD_MASK(6) /* Bits [29:24] - Command number */ 34 | #define SPI_CMD_INDEX_S 24 35 | #define SPI_RW_M BITFIELD_MASK(1) /* Bit [23] - Read=0, Write=1 */ 36 | #define SPI_RW_S 23 37 | #define SPI_FUNC_M BITFIELD_MASK(3) /* Bits [22:20] - Function Number */ 38 | #define SPI_FUNC_S 20 39 | #define SPI_RAW_M BITFIELD_MASK(1) /* Bit [19] - Read After Wr */ 40 | #define SPI_RAW_S 19 41 | #define SPI_STUFF_M BITFIELD_MASK(1) /* Bit [18] - Stuff bit */ 42 | #define SPI_STUFF_S 18 43 | #define SPI_BLKMODE_M BITFIELD_MASK(1) /* Bit [19] - Blockmode 1=blk */ 44 | #define SPI_BLKMODE_S 19 45 | #define SPI_OPCODE_M BITFIELD_MASK(1) /* Bit [18] - OP Code */ 46 | #define SPI_OPCODE_S 18 47 | #define SPI_ADDR_M BITFIELD_MASK(17) /* Bits [17:1] - Address */ 48 | #define SPI_ADDR_S 1 49 | #define SPI_STUFF0_M BITFIELD_MASK(1) /* Bit [0] - Stuff bit */ 50 | #define SPI_STUFF0_S 0 51 | 52 | #define SPI_RSP_START_M BITFIELD_MASK(1) /* Bit [7] - Start Bit (always 0) */ 53 | #define SPI_RSP_START_S 7 54 | #define SPI_RSP_PARAM_ERR_M BITFIELD_MASK(1) /* Bit [6] - Parameter Error */ 55 | #define SPI_RSP_PARAM_ERR_S 6 56 | #define SPI_RSP_RFU5_M BITFIELD_MASK(1) /* Bit [5] - RFU (Always 0) */ 57 | #define SPI_RSP_RFU5_S 5 58 | #define SPI_RSP_FUNC_ERR_M BITFIELD_MASK(1) /* Bit [4] - Function number error */ 59 | #define SPI_RSP_FUNC_ERR_S 4 60 | #define SPI_RSP_CRC_ERR_M BITFIELD_MASK(1) /* Bit [3] - COM CRC Error */ 61 | #define SPI_RSP_CRC_ERR_S 3 62 | #define SPI_RSP_ILL_CMD_M BITFIELD_MASK(1) /* Bit [2] - Illegal Command error */ 63 | #define SPI_RSP_ILL_CMD_S 2 64 | #define SPI_RSP_RFU1_M BITFIELD_MASK(1) /* Bit [1] - RFU (Always 0) */ 65 | #define SPI_RSP_RFU1_S 1 66 | #define SPI_RSP_IDLE_M BITFIELD_MASK(1) /* Bit [0] - In idle state */ 67 | #define SPI_RSP_IDLE_S 0 68 | 69 | /* SD-SPI Protocol Definitions */ 70 | #define SDSPI_COMMAND_LEN 6 /* Number of bytes in an SD command */ 71 | #define SDSPI_START_BLOCK 0xFE /* SD Start Block Token */ 72 | #define SDSPI_IDLE_PAD 0xFF /* SD-SPI idle value for MOSI */ 73 | #define SDSPI_START_BIT_MASK 0x80 74 | 75 | #endif /* _SD_SPI_H */ 76 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/proto/vlan.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 802.1Q VLAN protocol definitions 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: vlan.h 241182 2011-02-17 21:50:03Z $ 25 | */ 26 | 27 | #ifndef _vlan_h_ 28 | #define _vlan_h_ 29 | 30 | #ifndef _TYPEDEFS_H_ 31 | #include 32 | #endif 33 | 34 | /* This marks the start of a packed structure section. */ 35 | #include 36 | 37 | #define VLAN_VID_MASK 0xfff /* low 12 bits are vlan id */ 38 | #define VLAN_CFI_SHIFT 12 /* canonical format indicator bit */ 39 | #define VLAN_PRI_SHIFT 13 /* user priority */ 40 | 41 | #define VLAN_PRI_MASK 7 /* 3 bits of priority */ 42 | 43 | #define VLAN_TAG_LEN 4 44 | #define VLAN_TAG_OFFSET (2 * ETHER_ADDR_LEN) /* offset in Ethernet II packet only */ 45 | 46 | #define VLAN_TPID 0x8100 /* VLAN ethertype/Tag Protocol ID */ 47 | 48 | struct ethervlan_header { 49 | uint8 ether_dhost[ETHER_ADDR_LEN]; 50 | uint8 ether_shost[ETHER_ADDR_LEN]; 51 | uint16 vlan_type; /* 0x8100 */ 52 | uint16 vlan_tag; /* priority, cfi and vid */ 53 | uint16 ether_type; 54 | }; 55 | 56 | #define ETHERVLAN_HDR_LEN (ETHER_HDR_LEN + VLAN_TAG_LEN) 57 | 58 | 59 | /* This marks the end of a packed structure section. */ 60 | #include 61 | 62 | #define ETHERVLAN_MOVE_HDR(d, s) \ 63 | do { \ 64 | struct ethervlan_header t; \ 65 | t = *(struct ethervlan_header *)(s); \ 66 | *(struct ethervlan_header *)(d) = t; \ 67 | } while (0) 68 | 69 | #endif /* _vlan_h_ */ 70 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/proto/wpa.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Fundamental types and constants relating to WPA 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: wpa.h 261155 2011-05-23 23:51:32Z $ 25 | */ 26 | 27 | #ifndef _proto_wpa_h_ 28 | #define _proto_wpa_h_ 29 | 30 | #include 31 | #include 32 | 33 | 34 | /* This marks the start of a packed structure section. */ 35 | #include 36 | 37 | /* Reason Codes */ 38 | 39 | /* 13 through 23 taken from IEEE Std 802.11i-2004 */ 40 | #define DOT11_RC_INVALID_WPA_IE 13 /* Invalid info. element */ 41 | #define DOT11_RC_MIC_FAILURE 14 /* Michael failure */ 42 | #define DOT11_RC_4WH_TIMEOUT 15 /* 4-way handshake timeout */ 43 | #define DOT11_RC_GTK_UPDATE_TIMEOUT 16 /* Group key update timeout */ 44 | #define DOT11_RC_WPA_IE_MISMATCH 17 /* WPA IE in 4-way handshake differs from 45 | * (re-)assoc. request/probe response 46 | */ 47 | #define DOT11_RC_INVALID_MC_CIPHER 18 /* Invalid multicast cipher */ 48 | #define DOT11_RC_INVALID_UC_CIPHER 19 /* Invalid unicast cipher */ 49 | #define DOT11_RC_INVALID_AKMP 20 /* Invalid authenticated key management protocol */ 50 | #define DOT11_RC_BAD_WPA_VERSION 21 /* Unsupported WPA version */ 51 | #define DOT11_RC_INVALID_WPA_CAP 22 /* Invalid WPA IE capabilities */ 52 | #define DOT11_RC_8021X_AUTH_FAIL 23 /* 802.1X authentication failure */ 53 | 54 | #define WPA2_PMKID_LEN 16 55 | 56 | /* WPA IE fixed portion */ 57 | typedef BWL_PRE_PACKED_STRUCT struct 58 | { 59 | uint8 tag; /* TAG */ 60 | uint8 length; /* TAG length */ 61 | uint8 oui[3]; /* IE OUI */ 62 | uint8 oui_type; /* OUI type */ 63 | BWL_PRE_PACKED_STRUCT struct { 64 | uint8 low; 65 | uint8 high; 66 | } BWL_POST_PACKED_STRUCT version; /* IE version */ 67 | } BWL_POST_PACKED_STRUCT wpa_ie_fixed_t; 68 | #define WPA_IE_OUITYPE_LEN 4 69 | #define WPA_IE_FIXED_LEN 8 70 | #define WPA_IE_TAG_FIXED_LEN 6 71 | 72 | typedef BWL_PRE_PACKED_STRUCT struct { 73 | uint8 tag; /* TAG */ 74 | uint8 length; /* TAG length */ 75 | BWL_PRE_PACKED_STRUCT struct { 76 | uint8 low; 77 | uint8 high; 78 | } BWL_POST_PACKED_STRUCT version; /* IE version */ 79 | } BWL_POST_PACKED_STRUCT wpa_rsn_ie_fixed_t; 80 | #define WPA_RSN_IE_FIXED_LEN 4 81 | #define WPA_RSN_IE_TAG_FIXED_LEN 2 82 | typedef uint8 wpa_pmkid_t[WPA2_PMKID_LEN]; 83 | 84 | /* WPA suite/multicast suite */ 85 | typedef BWL_PRE_PACKED_STRUCT struct 86 | { 87 | uint8 oui[3]; 88 | uint8 type; 89 | } BWL_POST_PACKED_STRUCT wpa_suite_t, wpa_suite_mcast_t; 90 | #define WPA_SUITE_LEN 4 91 | 92 | /* WPA unicast suite list/key management suite list */ 93 | typedef BWL_PRE_PACKED_STRUCT struct 94 | { 95 | BWL_PRE_PACKED_STRUCT struct { 96 | uint8 low; 97 | uint8 high; 98 | } BWL_POST_PACKED_STRUCT count; 99 | wpa_suite_t list[1]; 100 | } BWL_POST_PACKED_STRUCT wpa_suite_ucast_t, wpa_suite_auth_key_mgmt_t; 101 | #define WPA_IE_SUITE_COUNT_LEN 2 102 | typedef BWL_PRE_PACKED_STRUCT struct 103 | { 104 | BWL_PRE_PACKED_STRUCT struct { 105 | uint8 low; 106 | uint8 high; 107 | } BWL_POST_PACKED_STRUCT count; 108 | wpa_pmkid_t list[1]; 109 | } BWL_POST_PACKED_STRUCT wpa_pmkid_list_t; 110 | 111 | /* WPA cipher suites */ 112 | #define WPA_CIPHER_NONE 0 /* None */ 113 | #define WPA_CIPHER_WEP_40 1 /* WEP (40-bit) */ 114 | #define WPA_CIPHER_TKIP 2 /* TKIP: default for WPA */ 115 | #define WPA_CIPHER_AES_OCB 3 /* AES (OCB) */ 116 | #define WPA_CIPHER_AES_CCM 4 /* AES (CCM) */ 117 | #define WPA_CIPHER_WEP_104 5 /* WEP (104-bit) */ 118 | #define WPA_CIPHER_BIP 6 /* WEP (104-bit) */ 119 | #define WPA_CIPHER_TPK 7 /* Group addressed traffic not allowed */ 120 | #ifdef BCMWAPI_WPI 121 | #define WAPI_CIPHER_NONE WPA_CIPHER_NONE 122 | #define WAPI_CIPHER_SMS4 11 123 | 124 | #define WAPI_CSE_WPI_SMS4 1 125 | #endif /* BCMWAPI_WPI */ 126 | 127 | 128 | #define IS_WPA_CIPHER(cipher) ((cipher) == WPA_CIPHER_NONE || \ 129 | (cipher) == WPA_CIPHER_WEP_40 || \ 130 | (cipher) == WPA_CIPHER_WEP_104 || \ 131 | (cipher) == WPA_CIPHER_TKIP || \ 132 | (cipher) == WPA_CIPHER_AES_OCB || \ 133 | (cipher) == WPA_CIPHER_AES_CCM || \ 134 | (cipher) == WPA_CIPHER_TPK) 135 | 136 | #ifdef BCMWAPI_WAI 137 | #define IS_WAPI_CIPHER(cipher) ((cipher) == WAPI_CIPHER_NONE || \ 138 | (cipher) == WAPI_CSE_WPI_SMS4) 139 | 140 | /* convert WAPI_CSE_WPI_XXX to WAPI_CIPHER_XXX */ 141 | #define WAPI_CSE_WPI_2_CIPHER(cse) ((cse) == WAPI_CSE_WPI_SMS4 ? \ 142 | WAPI_CIPHER_SMS4 : WAPI_CIPHER_NONE) 143 | 144 | #define WAPI_CIPHER_2_CSE_WPI(cipher) ((cipher) == WAPI_CIPHER_SMS4 ? \ 145 | WAPI_CSE_WPI_SMS4 : WAPI_CIPHER_NONE) 146 | #endif /* BCMWAPI_WAI */ 147 | 148 | 149 | /* WPA TKIP countermeasures parameters */ 150 | #define WPA_TKIP_CM_DETECT 60 /* multiple MIC failure window (seconds) */ 151 | #define WPA_TKIP_CM_BLOCK 60 /* countermeasures active window (seconds) */ 152 | 153 | /* RSN IE defines */ 154 | #define RSN_CAP_LEN 2 /* Length of RSN capabilities field (2 octets) */ 155 | 156 | /* RSN Capabilities defined in 802.11i */ 157 | #define RSN_CAP_PREAUTH 0x0001 158 | #define RSN_CAP_NOPAIRWISE 0x0002 159 | #define RSN_CAP_PTK_REPLAY_CNTR_MASK 0x000C 160 | #define RSN_CAP_PTK_REPLAY_CNTR_SHIFT 2 161 | #define RSN_CAP_GTK_REPLAY_CNTR_MASK 0x0030 162 | #define RSN_CAP_GTK_REPLAY_CNTR_SHIFT 4 163 | #define RSN_CAP_1_REPLAY_CNTR 0 164 | #define RSN_CAP_2_REPLAY_CNTRS 1 165 | #define RSN_CAP_4_REPLAY_CNTRS 2 166 | #define RSN_CAP_16_REPLAY_CNTRS 3 167 | #ifdef MFP 168 | #define RSN_CAP_MFPR 0x0040 169 | #define RSN_CAP_MFPC 0x0080 170 | #endif 171 | 172 | /* WPA capabilities defined in 802.11i */ 173 | #define WPA_CAP_4_REPLAY_CNTRS RSN_CAP_4_REPLAY_CNTRS 174 | #define WPA_CAP_16_REPLAY_CNTRS RSN_CAP_16_REPLAY_CNTRS 175 | #define WPA_CAP_REPLAY_CNTR_SHIFT RSN_CAP_PTK_REPLAY_CNTR_SHIFT 176 | #define WPA_CAP_REPLAY_CNTR_MASK RSN_CAP_PTK_REPLAY_CNTR_MASK 177 | 178 | /* WPA capabilities defined in 802.11zD9.0 */ 179 | #define WPA_CAP_PEER_KEY_ENABLE (0x1 << 1) /* bit 9 */ 180 | 181 | /* WPA Specific defines */ 182 | #define WPA_CAP_LEN RSN_CAP_LEN /* Length of RSN capabilities in RSN IE (2 octets) */ 183 | #define WPA_PMKID_CNT_LEN 2 /* Length of RSN PMKID count (2 octests) */ 184 | 185 | #define WPA_CAP_WPA2_PREAUTH RSN_CAP_PREAUTH 186 | 187 | #ifdef BCMWAPI_WAI 188 | #define WAPI_CAP_PREAUTH RSN_CAP_PREAUTH 189 | 190 | /* Other WAI definition */ 191 | #define WAPI_WAI_REQUEST 0x00F1 192 | #define WAPI_UNICAST_REKEY 0x00F2 193 | #define WAPI_STA_AGING 0x00F3 194 | #define WAPI_MUTIL_REKEY 0x00F4 195 | #define WAPI_STA_STATS 0x00F5 196 | 197 | #define WAPI_USK_REKEY_COUNT 0x4000000 /* 0xA00000 */ 198 | #define WAPI_MSK_REKEY_COUNT 0x4000000 /* 0xA00000 */ 199 | #endif /* BCMWAPI_WAI */ 200 | #define WPA2_PMKID_COUNT_LEN 2 201 | 202 | 203 | /* This marks the end of a packed structure section. */ 204 | #include 205 | 206 | #endif /* _proto_wpa_h_ */ 207 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/sbpcmcia.h: -------------------------------------------------------------------------------- 1 | /* 2 | * BCM43XX Sonics SiliconBackplane PCMCIA core hardware definitions. 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: sbpcmcia.h 326494 2012-04-09 13:29:57Z $ 25 | */ 26 | 27 | #ifndef _SBPCMCIA_H 28 | #define _SBPCMCIA_H 29 | 30 | /* All the addresses that are offsets in attribute space are divided 31 | * by two to account for the fact that odd bytes are invalid in 32 | * attribute space and our read/write routines make the space appear 33 | * as if they didn't exist. Still we want to show the original numbers 34 | * as documented in the hnd_pcmcia core manual. 35 | */ 36 | 37 | /* PCMCIA Function Configuration Registers */ 38 | #define PCMCIA_FCR (0x700 / 2) 39 | 40 | #define FCR0_OFF 0 41 | #define FCR1_OFF (0x40 / 2) 42 | #define FCR2_OFF (0x80 / 2) 43 | #define FCR3_OFF (0xc0 / 2) 44 | 45 | #define PCMCIA_FCR0 (0x700 / 2) 46 | #define PCMCIA_FCR1 (0x740 / 2) 47 | #define PCMCIA_FCR2 (0x780 / 2) 48 | #define PCMCIA_FCR3 (0x7c0 / 2) 49 | 50 | /* Standard PCMCIA FCR registers */ 51 | 52 | #define PCMCIA_COR 0 53 | 54 | #define COR_RST 0x80 55 | #define COR_LEV 0x40 56 | #define COR_IRQEN 0x04 57 | #define COR_BLREN 0x01 58 | #define COR_FUNEN 0x01 59 | 60 | 61 | #define PCICIA_FCSR (2 / 2) 62 | #define PCICIA_PRR (4 / 2) 63 | #define PCICIA_SCR (6 / 2) 64 | #define PCICIA_ESR (8 / 2) 65 | 66 | 67 | #define PCM_MEMOFF 0x0000 68 | #define F0_MEMOFF 0x1000 69 | #define F1_MEMOFF 0x2000 70 | #define F2_MEMOFF 0x3000 71 | #define F3_MEMOFF 0x4000 72 | 73 | /* Memory base in the function fcr's */ 74 | #define MEM_ADDR0 (0x728 / 2) 75 | #define MEM_ADDR1 (0x72a / 2) 76 | #define MEM_ADDR2 (0x72c / 2) 77 | 78 | /* PCMCIA base plus Srom access in fcr0: */ 79 | #define PCMCIA_ADDR0 (0x072e / 2) 80 | #define PCMCIA_ADDR1 (0x0730 / 2) 81 | #define PCMCIA_ADDR2 (0x0732 / 2) 82 | 83 | #define MEM_SEG (0x0734 / 2) 84 | #define SROM_CS (0x0736 / 2) 85 | #define SROM_DATAL (0x0738 / 2) 86 | #define SROM_DATAH (0x073a / 2) 87 | #define SROM_ADDRL (0x073c / 2) 88 | #define SROM_ADDRH (0x073e / 2) 89 | #define SROM_INFO2 (0x0772 / 2) /* Corerev >= 2 && <= 5 */ 90 | #define SROM_INFO (0x07be / 2) /* Corerev >= 6 */ 91 | 92 | /* Values for srom_cs: */ 93 | #define SROM_IDLE 0 94 | #define SROM_WRITE 1 95 | #define SROM_READ 2 96 | #define SROM_WEN 4 97 | #define SROM_WDS 7 98 | #define SROM_DONE 8 99 | 100 | /* Fields in srom_info: */ 101 | #define SRI_SZ_MASK 0x03 102 | #define SRI_BLANK 0x04 103 | #define SRI_OTP 0x80 104 | 105 | 106 | /* sbtmstatelow */ 107 | #define SBTML_INT_ACK 0x40000 /* ack the sb interrupt */ 108 | #define SBTML_INT_EN 0x20000 /* enable sb interrupt */ 109 | 110 | /* sbtmstatehigh */ 111 | #define SBTMH_INT_STATUS 0x40000 /* sb interrupt status */ 112 | 113 | #endif /* _SBPCMCIA_H */ 114 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/sbsocram.h: -------------------------------------------------------------------------------- 1 | /* 2 | * BCM47XX Sonics SiliconBackplane embedded ram core 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: sbsocram.h 271781 2011-07-13 20:00:06Z $ 25 | */ 26 | 27 | #ifndef _SBSOCRAM_H 28 | #define _SBSOCRAM_H 29 | 30 | #ifndef _LANGUAGE_ASSEMBLY 31 | 32 | /* cpp contortions to concatenate w/arg prescan */ 33 | #ifndef PAD 34 | #define _PADLINE(line) pad ## line 35 | #define _XSTR(line) _PADLINE(line) 36 | #define PAD _XSTR(__LINE__) 37 | #endif /* PAD */ 38 | 39 | /* Memcsocram core registers */ 40 | typedef volatile struct sbsocramregs { 41 | uint32 coreinfo; 42 | uint32 bwalloc; 43 | uint32 extracoreinfo; 44 | uint32 biststat; 45 | uint32 bankidx; 46 | uint32 standbyctrl; 47 | 48 | uint32 errlogstatus; /* rev 6 */ 49 | uint32 errlogaddr; /* rev 6 */ 50 | /* used for patching rev 3 & 5 */ 51 | uint32 cambankidx; 52 | uint32 cambankstandbyctrl; 53 | uint32 cambankpatchctrl; 54 | uint32 cambankpatchtblbaseaddr; 55 | uint32 cambankcmdreg; 56 | uint32 cambankdatareg; 57 | uint32 cambankmaskreg; 58 | uint32 PAD[1]; 59 | uint32 bankinfo; /* corev 8 */ 60 | uint32 PAD[15]; 61 | uint32 extmemconfig; 62 | uint32 extmemparitycsr; 63 | uint32 extmemparityerrdata; 64 | uint32 extmemparityerrcnt; 65 | uint32 extmemwrctrlandsize; 66 | uint32 PAD[84]; 67 | uint32 workaround; 68 | uint32 pwrctl; /* corerev >= 2 */ 69 | uint32 PAD[133]; 70 | uint32 sr_control; /* corerev >= 15 */ 71 | uint32 sr_status; /* corerev >= 15 */ 72 | uint32 sr_address; /* corerev >= 15 */ 73 | uint32 sr_data; /* corerev >= 15 */ 74 | } sbsocramregs_t; 75 | 76 | #endif /* _LANGUAGE_ASSEMBLY */ 77 | 78 | /* Register offsets */ 79 | #define SR_COREINFO 0x00 80 | #define SR_BWALLOC 0x04 81 | #define SR_BISTSTAT 0x0c 82 | #define SR_BANKINDEX 0x10 83 | #define SR_BANKSTBYCTL 0x14 84 | #define SR_PWRCTL 0x1e8 85 | 86 | /* Coreinfo register */ 87 | #define SRCI_PT_MASK 0x00070000 /* corerev >= 6; port type[18:16] */ 88 | #define SRCI_PT_SHIFT 16 89 | /* port types : SRCI_PT__ */ 90 | #define SRCI_PT_OCP_OCP 0 91 | #define SRCI_PT_AXI_OCP 1 92 | #define SRCI_PT_ARM7AHB_OCP 2 93 | #define SRCI_PT_CM3AHB_OCP 3 94 | #define SRCI_PT_AXI_AXI 4 95 | #define SRCI_PT_AHB_AXI 5 96 | /* corerev >= 3 */ 97 | #define SRCI_LSS_MASK 0x00f00000 98 | #define SRCI_LSS_SHIFT 20 99 | #define SRCI_LRS_MASK 0x0f000000 100 | #define SRCI_LRS_SHIFT 24 101 | 102 | /* In corerev 0, the memory size is 2 to the power of the 103 | * base plus 16 plus to the contents of the memsize field plus 1. 104 | */ 105 | #define SRCI_MS0_MASK 0xf 106 | #define SR_MS0_BASE 16 107 | 108 | /* 109 | * In corerev 1 the bank size is 2 ^ the bank size field plus 14, 110 | * the memory size is number of banks times bank size. 111 | * The same applies to rom size. 112 | */ 113 | #define SRCI_ROMNB_MASK 0xf000 114 | #define SRCI_ROMNB_SHIFT 12 115 | #define SRCI_ROMBSZ_MASK 0xf00 116 | #define SRCI_ROMBSZ_SHIFT 8 117 | #define SRCI_SRNB_MASK 0xf0 118 | #define SRCI_SRNB_SHIFT 4 119 | #define SRCI_SRBSZ_MASK 0xf 120 | #define SRCI_SRBSZ_SHIFT 0 121 | 122 | #define SR_BSZ_BASE 14 123 | 124 | /* Standby control register */ 125 | #define SRSC_SBYOVR_MASK 0x80000000 126 | #define SRSC_SBYOVR_SHIFT 31 127 | #define SRSC_SBYOVRVAL_MASK 0x60000000 128 | #define SRSC_SBYOVRVAL_SHIFT 29 129 | #define SRSC_SBYEN_MASK 0x01000000 /* rev >= 3 */ 130 | #define SRSC_SBYEN_SHIFT 24 131 | 132 | /* Power control register */ 133 | #define SRPC_PMU_STBYDIS_MASK 0x00000010 /* rev >= 3 */ 134 | #define SRPC_PMU_STBYDIS_SHIFT 4 135 | #define SRPC_STBYOVRVAL_MASK 0x00000008 136 | #define SRPC_STBYOVRVAL_SHIFT 3 137 | #define SRPC_STBYOVR_MASK 0x00000007 138 | #define SRPC_STBYOVR_SHIFT 0 139 | 140 | /* Extra core capability register */ 141 | #define SRECC_NUM_BANKS_MASK 0x000000F0 142 | #define SRECC_NUM_BANKS_SHIFT 4 143 | #define SRECC_BANKSIZE_MASK 0x0000000F 144 | #define SRECC_BANKSIZE_SHIFT 0 145 | 146 | #define SRECC_BANKSIZE(value) (1 << (value)) 147 | 148 | /* CAM bank patch control */ 149 | #define SRCBPC_PATCHENABLE 0x80000000 150 | 151 | #define SRP_ADDRESS 0x0001FFFC 152 | #define SRP_VALID 0x8000 153 | 154 | /* CAM bank command reg */ 155 | #define SRCMD_WRITE 0x00020000 156 | #define SRCMD_READ 0x00010000 157 | #define SRCMD_DONE 0x80000000 158 | 159 | #define SRCMD_DONE_DLY 1000 160 | 161 | /* bankidx and bankinfo reg defines corerev >= 8 */ 162 | #define SOCRAM_BANKINFO_SZMASK 0x7f 163 | #define SOCRAM_BANKIDX_ROM_MASK 0x100 164 | 165 | #define SOCRAM_BANKIDX_MEMTYPE_SHIFT 8 166 | /* socram bankinfo memtype */ 167 | #define SOCRAM_MEMTYPE_RAM 0 168 | #define SOCRAM_MEMTYPE_R0M 1 169 | #define SOCRAM_MEMTYPE_DEVRAM 2 170 | 171 | #define SOCRAM_BANKINFO_REG 0x40 172 | #define SOCRAM_BANKIDX_REG 0x10 173 | #define SOCRAM_BANKINFO_STDBY_MASK 0x400 174 | #define SOCRAM_BANKINFO_STDBY_TIMER 0x800 175 | 176 | /* bankinfo rev >= 10 */ 177 | #define SOCRAM_BANKINFO_DEVRAMSEL_SHIFT 13 178 | #define SOCRAM_BANKINFO_DEVRAMSEL_MASK 0x2000 179 | #define SOCRAM_BANKINFO_DEVRAMPRO_SHIFT 14 180 | #define SOCRAM_BANKINFO_DEVRAMPRO_MASK 0x4000 181 | #define SOCRAM_BANKINFO_SLPSUPP_SHIFT 15 182 | #define SOCRAM_BANKINFO_SLPSUPP_MASK 0x8000 183 | #define SOCRAM_BANKINFO_RETNTRAM_SHIFT 16 184 | #define SOCRAM_BANKINFO_RETNTRAM_MASK 0x00010000 185 | #define SOCRAM_BANKINFO_PDASZ_SHIFT 17 186 | #define SOCRAM_BANKINFO_PDASZ_MASK 0x003E0000 187 | #define SOCRAM_BANKINFO_DEVRAMREMAP_SHIFT 24 188 | #define SOCRAM_BANKINFO_DEVRAMREMAP_MASK 0x01000000 189 | 190 | /* extracoreinfo register */ 191 | #define SOCRAM_DEVRAMBANK_MASK 0xF000 192 | #define SOCRAM_DEVRAMBANK_SHIFT 12 193 | 194 | /* bank info to calculate bank size */ 195 | #define SOCRAM_BANKINFO_SZBASE 8192 196 | #define SOCRAM_BANKSIZE_SHIFT 13 /* SOCRAM_BANKINFO_SZBASE */ 197 | 198 | 199 | #endif /* _SBSOCRAM_H */ 200 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/sdiovar.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Structure used by apps whose drivers access SDIO drivers. 3 | * Pulled out separately so dhdu and wlu can both use it. 4 | * 5 | * Copyright (C) 1999-2012, Broadcom Corporation 6 | * 7 | * Unless you and Broadcom execute a separate written software license 8 | * agreement governing use of this software, this software is licensed to you 9 | * under the terms of the GNU General Public License version 2 (the "GPL"), 10 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 11 | * following added to such license: 12 | * 13 | * As a special exception, the copyright holders of this software give you 14 | * permission to link this software with independent modules, and to copy and 15 | * distribute the resulting executable under terms of your choice, provided that 16 | * you also meet, for each linked independent module, the terms and conditions of 17 | * the license of that module. An independent module is a module which is not 18 | * derived from this software. The special exception does not apply to any 19 | * modifications of the software. 20 | * 21 | * Notwithstanding the above, under no circumstances may you combine this 22 | * software in any way with any other Broadcom software provided under a license 23 | * other than the GPL, without Broadcom's express prior written consent. 24 | * 25 | * $Id: sdiovar.h 241182 2011-02-17 21:50:03Z $ 26 | */ 27 | 28 | #ifndef _sdiovar_h_ 29 | #define _sdiovar_h_ 30 | 31 | #include 32 | 33 | /* require default structure packing */ 34 | #define BWL_DEFAULT_PACKING 35 | #include 36 | 37 | typedef struct sdreg { 38 | int func; 39 | int offset; 40 | int value; 41 | } sdreg_t; 42 | 43 | /* Common msglevel constants */ 44 | #define SDH_ERROR_VAL 0x0001 /* Error */ 45 | #define SDH_TRACE_VAL 0x0002 /* Trace */ 46 | #define SDH_INFO_VAL 0x0004 /* Info */ 47 | #define SDH_DEBUG_VAL 0x0008 /* Debug */ 48 | #define SDH_DATA_VAL 0x0010 /* Data */ 49 | #define SDH_CTRL_VAL 0x0020 /* Control Regs */ 50 | #define SDH_LOG_VAL 0x0040 /* Enable bcmlog */ 51 | #define SDH_DMA_VAL 0x0080 /* DMA */ 52 | 53 | #define NUM_PREV_TRANSACTIONS 16 54 | 55 | 56 | #include 57 | 58 | #endif /* _sdiovar_h_ */ 59 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/include/trxhdr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TRX image file header format. 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: trxhdr.h 260898 2011-05-20 23:11:12Z $ 25 | */ 26 | 27 | #ifndef _TRX_HDR_H 28 | #define _TRX_HDR_H 29 | 30 | #include 31 | 32 | #define TRX_MAGIC 0x30524448 /* "HDR0" */ 33 | #define TRX_VERSION 1 /* Version 1 */ 34 | #define TRX_MAX_LEN 0x3B0000 /* Max length */ 35 | #define TRX_NO_HEADER 1 /* Do not write TRX header */ 36 | #define TRX_GZ_FILES 0x2 /* Contains up to TRX_MAX_OFFSET individual gzip files */ 37 | #define TRX_EMBED_UCODE 0x8 /* Trx contains embedded ucode image */ 38 | #define TRX_ROMSIM_IMAGE 0x10 /* Trx contains ROM simulation image */ 39 | #define TRX_UNCOMP_IMAGE 0x20 /* Trx contains uncompressed rtecdc.bin image */ 40 | #define TRX_MAX_OFFSET 3 /* Max number of individual files */ 41 | 42 | struct trx_header { 43 | uint32 magic; /* "HDR0" */ 44 | uint32 len; /* Length of file including header */ 45 | uint32 crc32; /* 32-bit CRC from flag_version to end of file */ 46 | uint32 flag_version; /* 0:15 flags, 16:31 version */ 47 | uint32 offsets[TRX_MAX_OFFSET]; /* Offsets of partitions from start of header */ 48 | }; 49 | 50 | /* Compatibility */ 51 | typedef struct trx_header TRXHDR, *PTRXHDR; 52 | 53 | #endif /* _TRX_HDR_H */ 54 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/uamp_api.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Name: uamp_api.h 3 | * 4 | * Description: Universal AMP API 5 | * 6 | * Copyright (C) 1999-2012, Broadcom Corporation 7 | * 8 | * Unless you and Broadcom execute a separate written software license 9 | * agreement governing use of this software, this software is licensed to you 10 | * under the terms of the GNU General Public License version 2 (the "GPL"), 11 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 12 | * following added to such license: 13 | * 14 | * As a special exception, the copyright holders of this software give you 15 | * permission to link this software with independent modules, and to copy and 16 | * distribute the resulting executable under terms of your choice, provided that 17 | * you also meet, for each linked independent module, the terms and conditions of 18 | * the license of that module. An independent module is a module which is not 19 | * derived from this software. The special exception does not apply to any 20 | * modifications of the software. 21 | * 22 | * Notwithstanding the above, under no circumstances may you combine this 23 | * software in any way with any other Broadcom software provided under a license 24 | * other than the GPL, without Broadcom's express prior written consent. 25 | * 26 | * $Id: uamp_api.h 294267 2011-11-04 23:41:52Z $ 27 | * 28 | */ 29 | #ifndef UAMP_API_H 30 | #define UAMP_API_H 31 | 32 | 33 | #include "typedefs.h" 34 | 35 | 36 | /***************************************************************************** 37 | ** Constant and Type Definitions 38 | ****************************************************************************** 39 | */ 40 | 41 | #define BT_API 42 | 43 | /* Types. */ 44 | typedef bool BOOLEAN; 45 | typedef uint8 UINT8; 46 | typedef uint16 UINT16; 47 | 48 | 49 | /* UAMP identifiers */ 50 | #define UAMP_ID_1 1 51 | #define UAMP_ID_2 2 52 | typedef UINT8 tUAMP_ID; 53 | 54 | /* UAMP event ids (used by UAMP_CBACK) */ 55 | #define UAMP_EVT_RX_READY 0 /* Data from AMP controller is ready to be read */ 56 | #define UAMP_EVT_CTLR_REMOVED 1 /* Controller removed */ 57 | #define UAMP_EVT_CTLR_READY 2 /* Controller added/ready */ 58 | typedef UINT8 tUAMP_EVT; 59 | 60 | 61 | /* UAMP Channels */ 62 | #define UAMP_CH_HCI_CMD 0 /* HCI Command channel */ 63 | #define UAMP_CH_HCI_EVT 1 /* HCI Event channel */ 64 | #define UAMP_CH_HCI_DATA 2 /* HCI ACL Data channel */ 65 | typedef UINT8 tUAMP_CH; 66 | 67 | /* tUAMP_EVT_DATA: union for event-specific data, used by UAMP_CBACK */ 68 | typedef union { 69 | tUAMP_CH channel; /* UAMP_EVT_RX_READY: channel for which rx occured */ 70 | } tUAMP_EVT_DATA; 71 | 72 | 73 | /***************************************************************************** 74 | ** 75 | ** Function: UAMP_CBACK 76 | ** 77 | ** Description: Callback for events. Register callback using UAMP_Init. 78 | ** 79 | ** Parameters amp_id: AMP device identifier that generated the event 80 | ** amp_evt: event id 81 | ** p_amp_evt_data: pointer to event-specific data 82 | ** 83 | ****************************************************************************** 84 | */ 85 | typedef void (*tUAMP_CBACK)(tUAMP_ID amp_id, tUAMP_EVT amp_evt, tUAMP_EVT_DATA *p_amp_evt_data); 86 | 87 | /***************************************************************************** 88 | ** external function declarations 89 | ****************************************************************************** 90 | */ 91 | #ifdef __cplusplus 92 | extern "C" 93 | { 94 | #endif 95 | 96 | /***************************************************************************** 97 | ** 98 | ** Function: UAMP_Init 99 | ** 100 | ** Description: Initialize UAMP driver 101 | ** 102 | ** Parameters p_cback: Callback function for UAMP event notification 103 | ** 104 | ****************************************************************************** 105 | */ 106 | BT_API BOOLEAN UAMP_Init(tUAMP_CBACK p_cback); 107 | 108 | 109 | /***************************************************************************** 110 | ** 111 | ** Function: UAMP_Open 112 | ** 113 | ** Description: Open connection to local AMP device. 114 | ** 115 | ** Parameters app_id: Application specific AMP identifer. This value 116 | ** will be included in AMP messages sent to the 117 | ** BTU task, to identify source of the message 118 | ** 119 | ****************************************************************************** 120 | */ 121 | BT_API BOOLEAN UAMP_Open(tUAMP_ID amp_id); 122 | 123 | /***************************************************************************** 124 | ** 125 | ** Function: UAMP_Close 126 | ** 127 | ** Description: Close connection to local AMP device. 128 | ** 129 | ** Parameters app_id: Application specific AMP identifer. 130 | ** 131 | ****************************************************************************** 132 | */ 133 | BT_API void UAMP_Close(tUAMP_ID amp_id); 134 | 135 | 136 | /***************************************************************************** 137 | ** 138 | ** Function: UAMP_Write 139 | ** 140 | ** Description: Send buffer to AMP device. Frees GKI buffer when done. 141 | ** 142 | ** 143 | ** Parameters: app_id: AMP identifer. 144 | ** p_buf: pointer to buffer to write 145 | ** num_bytes: number of bytes to write 146 | ** channel: UAMP_CH_HCI_ACL, or UAMP_CH_HCI_CMD 147 | ** 148 | ** Returns: number of bytes written 149 | ** 150 | ****************************************************************************** 151 | */ 152 | BT_API UINT16 UAMP_Write(tUAMP_ID amp_id, UINT8 *p_buf, UINT16 num_bytes, tUAMP_CH channel); 153 | 154 | /***************************************************************************** 155 | ** 156 | ** Function: UAMP_Read 157 | ** 158 | ** Description: Read incoming data from AMP. Call after receiving a 159 | ** UAMP_EVT_RX_READY callback event. 160 | ** 161 | ** Parameters: app_id: AMP identifer. 162 | ** p_buf: pointer to buffer for holding incoming AMP data 163 | ** buf_size: size of p_buf 164 | ** channel: UAMP_CH_HCI_ACL, or UAMP_CH_HCI_EVT 165 | ** 166 | ** Returns: number of bytes read 167 | ** 168 | ****************************************************************************** 169 | */ 170 | BT_API UINT16 UAMP_Read(tUAMP_ID amp_id, UINT8 *p_buf, UINT16 buf_size, tUAMP_CH channel); 171 | 172 | #ifdef __cplusplus 173 | } 174 | #endif 175 | 176 | #endif /* UAMP_API_H */ 177 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/wl_android.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Linux cfg80211 driver - Android related functions 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: wl_android.h 367273 2012-11-07 09:58:55Z $ 25 | */ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | /* If any feature uses the Generic Netlink Interface, put it here to enable WL_GENL 32 | * automatically 33 | */ 34 | 35 | /** 36 | * Android platform dependent functions, feel free to add Android specific functions here 37 | * (save the macros in dhd). Please do NOT declare functions that are NOT exposed to dhd 38 | * or cfg, define them as static in wl_android.c 39 | */ 40 | 41 | /** 42 | * wl_android_init will be called from module init function (dhd_module_init now), similarly 43 | * wl_android_exit will be called from module exit function (dhd_module_cleanup now) 44 | */ 45 | int wl_android_init(void); 46 | int wl_android_exit(void); 47 | void wl_android_post_init(void); 48 | int wl_android_wifi_on(struct net_device *dev); 49 | int wl_android_wifi_off(struct net_device *dev); 50 | int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd); 51 | 52 | #define BSSCACHE 53 | #define RSSIAVG 54 | #define RSSIOFFSET 55 | //#define RSSIOFFSET_NEW 56 | 57 | #if defined(RSSIAVG) 58 | #define RSSIAVG_LEN 8 59 | #define RSSICACHE_LEN 8 60 | 61 | typedef struct wl_rssi_cache { 62 | struct wl_rssi_cache *next; 63 | int dirty; 64 | struct ether_addr BSSID; 65 | int16 RSSI[RSSIAVG_LEN]; 66 | } wl_rssi_cache_t; 67 | 68 | typedef struct wl_rssi_cache_ctrl { 69 | wl_rssi_cache_t *m_cache_head; 70 | } wl_rssi_cache_ctrl_t; 71 | 72 | void wl_free_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl); 73 | void wl_delete_dirty_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl); 74 | void wl_reset_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl); 75 | void wl_update_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, wl_scan_results_t *ss_list); 76 | void wl_update_connected_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, struct net_device *net); 77 | int16 wl_get_avg_rssi(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, void *addr); 78 | #endif 79 | 80 | #if defined(RSSIOFFSET) 81 | #define RSSI_OFFSET 5 82 | #define RSSI_MAX -80 83 | #define RSSI_MIN -94 84 | #define RSSI_INT ((RSSI_MAX-RSSI_MIN)/RSSI_OFFSET) 85 | #define BCM4330_CHIP_ID 0x4330 86 | #define BCM4330B2_CHIP_REV 4 87 | int wl_update_rssi_offset(int rssi); 88 | #endif 89 | 90 | #if defined(BSSCACHE) 91 | #define BSSCACHE_LEN 8 92 | #define BSSCACHE_TIME 15000 93 | 94 | typedef struct wl_bss_cache { 95 | struct wl_bss_cache *next; 96 | int dirty; 97 | wl_scan_results_t results; 98 | } wl_bss_cache_t; 99 | 100 | typedef struct wl_bss_cache_ctrl { 101 | wl_bss_cache_t *m_cache_head; 102 | struct timer_list *m_timer; 103 | int m_timer_expired; 104 | } wl_bss_cache_ctrl_t; 105 | 106 | void wl_free_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl); 107 | void wl_delete_dirty_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl); 108 | void wl_reset_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl); 109 | void wl_update_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl, wl_scan_results_t *ss_list); 110 | void wl_run_bss_cache_timer(wl_bss_cache_ctrl_t *bss_cache_ctrl, int kick_off); 111 | void wl_release_bss_cache_ctrl(wl_bss_cache_ctrl_t *bss_cache_ctrl); 112 | void wl_init_bss_cache_ctrl(wl_bss_cache_ctrl_t *bss_cache_ctrl); 113 | #endif 114 | 115 | #if defined(CONFIG_WIFI_CONTROL_FUNC) 116 | int wl_android_wifictrl_func_add(void); 117 | void wl_android_wifictrl_func_del(void); 118 | void* wl_android_prealloc(int section, unsigned long size); 119 | 120 | int wifi_get_irq_number(unsigned long *irq_flags_ptr); 121 | int wifi_set_power(int on, unsigned long msec); 122 | int wifi_get_mac_addr(unsigned char *buf); 123 | void *wifi_get_country_code(char *ccode); 124 | #endif /* CONFIG_WIFI_CONTROL_FUNC */ 125 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/wl_iw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Linux Wireless Extensions support 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: wl_iw.h 291086 2011-10-21 01:17:24Z $ 25 | */ 26 | 27 | #ifndef _wl_iw_h_ 28 | #define _wl_iw_h_ 29 | 30 | #include 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | #define WL_SCAN_PARAMS_SSID_MAX 10 37 | #define GET_SSID "SSID=" 38 | #define GET_CHANNEL "CH=" 39 | #define GET_NPROBE "NPROBE=" 40 | #define GET_ACTIVE_ASSOC_DWELL "ACTIVE=" 41 | #define GET_PASSIVE_ASSOC_DWELL "PASSIVE=" 42 | #define GET_HOME_DWELL "HOME=" 43 | #define GET_SCAN_TYPE "TYPE=" 44 | 45 | #define BAND_GET_CMD "GETBAND" 46 | #define BAND_SET_CMD "SETBAND" 47 | #define DTIM_SKIP_GET_CMD "DTIMSKIPGET" 48 | #define DTIM_SKIP_SET_CMD "DTIMSKIPSET" 49 | #define SETSUSPEND_CMD "SETSUSPENDOPT" 50 | #define PNOSSIDCLR_SET_CMD "PNOSSIDCLR" 51 | /* Lin - Is the extra space needed? */ 52 | #define PNOSETUP_SET_CMD "PNOSETUP " /* TLV command has extra end space */ 53 | #define PNOENABLE_SET_CMD "PNOFORCE" 54 | #define PNODEBUG_SET_CMD "PNODEBUG" 55 | #define TXPOWER_SET_CMD "TXPOWER" 56 | 57 | #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5] 58 | #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x" 59 | 60 | /* Structure to keep global parameters */ 61 | typedef struct wl_iw_extra_params { 62 | int target_channel; /* target channel */ 63 | } wl_iw_extra_params_t; 64 | 65 | struct cntry_locales_custom { 66 | char iso_abbrev[WLC_CNTRY_BUF_SZ]; /* ISO 3166-1 country abbreviation */ 67 | char custom_locale[WLC_CNTRY_BUF_SZ]; /* Custom firmware locale */ 68 | int32 custom_locale_rev; /* Custom local revisin default -1 */ 69 | }; 70 | /* ============================================== */ 71 | /* Defines from wlc_pub.h */ 72 | #define WL_IW_RSSI_MINVAL -200 /* Low value, e.g. for forcing roam */ 73 | #define WL_IW_RSSI_NO_SIGNAL -91 /* NDIS RSSI link quality cutoffs */ 74 | #define WL_IW_RSSI_VERY_LOW -80 /* Very low quality cutoffs */ 75 | #define WL_IW_RSSI_LOW -70 /* Low quality cutoffs */ 76 | #define WL_IW_RSSI_GOOD -68 /* Good quality cutoffs */ 77 | #define WL_IW_RSSI_VERY_GOOD -58 /* Very good quality cutoffs */ 78 | #define WL_IW_RSSI_EXCELLENT -57 /* Excellent quality cutoffs */ 79 | #define WL_IW_RSSI_INVALID 0 /* invalid RSSI value */ 80 | #define MAX_WX_STRING 80 81 | #define SSID_FMT_BUF_LEN ((4 * 32) + 1) 82 | #define isprint(c) bcm_isprint(c) 83 | #define WL_IW_SET_ACTIVE_SCAN (SIOCIWFIRSTPRIV+1) 84 | #define WL_IW_GET_RSSI (SIOCIWFIRSTPRIV+3) 85 | #define WL_IW_SET_PASSIVE_SCAN (SIOCIWFIRSTPRIV+5) 86 | #define WL_IW_GET_LINK_SPEED (SIOCIWFIRSTPRIV+7) 87 | #define WL_IW_GET_CURR_MACADDR (SIOCIWFIRSTPRIV+9) 88 | #define WL_IW_SET_STOP (SIOCIWFIRSTPRIV+11) 89 | #define WL_IW_SET_START (SIOCIWFIRSTPRIV+13) 90 | 91 | #define G_SCAN_RESULTS 8*1024 92 | #define WE_ADD_EVENT_FIX 0x80 93 | #define G_WLAN_SET_ON 0 94 | #define G_WLAN_SET_OFF 1 95 | 96 | 97 | typedef struct wl_iw { 98 | char nickname[IW_ESSID_MAX_SIZE]; 99 | 100 | struct iw_statistics wstats; 101 | 102 | int spy_num; 103 | uint32 pwsec; /* pairwise wsec setting */ 104 | uint32 gwsec; /* group wsec setting */ 105 | bool privacy_invoked; /* IW_AUTH_PRIVACY_INVOKED setting */ 106 | struct ether_addr spy_addr[IW_MAX_SPY]; 107 | struct iw_quality spy_qual[IW_MAX_SPY]; 108 | void *wlinfo; 109 | } wl_iw_t; 110 | 111 | struct wl_ctrl { 112 | struct timer_list *timer; 113 | struct net_device *dev; 114 | long sysioc_pid; 115 | struct semaphore sysioc_sem; 116 | struct completion sysioc_exited; 117 | }; 118 | 119 | 120 | #if WIRELESS_EXT > 12 121 | #include 122 | extern const struct iw_handler_def wl_iw_handler_def; 123 | #endif /* WIRELESS_EXT > 12 */ 124 | 125 | extern int wl_iw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 126 | extern void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data); 127 | extern int wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats); 128 | int wl_iw_attach(struct net_device *dev, void * dhdp); 129 | int wl_iw_send_priv_event(struct net_device *dev, char *flag); 130 | 131 | void wl_iw_detach(void); 132 | 133 | #define CSCAN_COMMAND "CSCAN " 134 | #define CSCAN_TLV_PREFIX 'S' 135 | #define CSCAN_TLV_VERSION 1 136 | #define CSCAN_TLV_SUBVERSION 0 137 | #define CSCAN_TLV_TYPE_SSID_IE 'S' 138 | #define CSCAN_TLV_TYPE_CHANNEL_IE 'C' 139 | #define CSCAN_TLV_TYPE_NPROBE_IE 'N' 140 | #define CSCAN_TLV_TYPE_ACTIVE_IE 'A' 141 | #define CSCAN_TLV_TYPE_PASSIVE_IE 'P' 142 | #define CSCAN_TLV_TYPE_HOME_IE 'H' 143 | #define CSCAN_TLV_TYPE_STYPE_IE 'T' 144 | 145 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) 146 | #define IWE_STREAM_ADD_EVENT(info, stream, ends, iwe, extra) \ 147 | iwe_stream_add_event(info, stream, ends, iwe, extra) 148 | #define IWE_STREAM_ADD_VALUE(info, event, value, ends, iwe, event_len) \ 149 | iwe_stream_add_value(info, event, value, ends, iwe, event_len) 150 | #define IWE_STREAM_ADD_POINT(info, stream, ends, iwe, extra) \ 151 | iwe_stream_add_point(info, stream, ends, iwe, extra) 152 | #else 153 | #define IWE_STREAM_ADD_EVENT(info, stream, ends, iwe, extra) \ 154 | iwe_stream_add_event(stream, ends, iwe, extra) 155 | #define IWE_STREAM_ADD_VALUE(info, event, value, ends, iwe, event_len) \ 156 | iwe_stream_add_value(event, value, ends, iwe, event_len) 157 | #define IWE_STREAM_ADD_POINT(info, stream, ends, iwe, extra) \ 158 | iwe_stream_add_point(stream, ends, iwe, extra) 159 | #endif 160 | 161 | #endif /* _wl_iw_h_ */ 162 | -------------------------------------------------------------------------------- /drivers/net/wireless/ap6210/wldev_common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Common function shared by Linux WEXT, cfg80211 and p2p drivers 3 | * 4 | * Copyright (C) 1999-2012, Broadcom Corporation 5 | * 6 | * Unless you and Broadcom execute a separate written software license 7 | * agreement governing use of this software, this software is licensed to you 8 | * under the terms of the GNU General Public License version 2 (the "GPL"), 9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 | * following added to such license: 11 | * 12 | * As a special exception, the copyright holders of this software give you 13 | * permission to link this software with independent modules, and to copy and 14 | * distribute the resulting executable under terms of your choice, provided that 15 | * you also meet, for each linked independent module, the terms and conditions of 16 | * the license of that module. An independent module is a module which is not 17 | * derived from this software. The special exception does not apply to any 18 | * modifications of the software. 19 | * 20 | * Notwithstanding the above, under no circumstances may you combine this 21 | * software in any way with any other Broadcom software provided under a license 22 | * other than the GPL, without Broadcom's express prior written consent. 23 | * 24 | * $Id: wldev_common.h,v 1.1.4.1.2.14 2011-02-09 01:40:07 $ 25 | */ 26 | #ifndef __WLDEV_COMMON_H__ 27 | #define __WLDEV_COMMON_H__ 28 | 29 | #include 30 | 31 | /* wl_dev_ioctl - get/set IOCTLs, will call net_device's do_ioctl (or 32 | * netdev_ops->ndo_do_ioctl in new kernels) 33 | * @dev: the net_device handle 34 | */ 35 | s32 wldev_ioctl( 36 | struct net_device *dev, u32 cmd, void *arg, u32 len, u32 set); 37 | 38 | /** Retrieve named IOVARs, this function calls wl_dev_ioctl with 39 | * WLC_GET_VAR IOCTL code 40 | */ 41 | s32 wldev_iovar_getbuf( 42 | struct net_device *dev, s8 *iovar_name, 43 | void *param, s32 paramlen, void *buf, s32 buflen, struct mutex* buf_sync); 44 | 45 | /** Set named IOVARs, this function calls wl_dev_ioctl with 46 | * WLC_SET_VAR IOCTL code 47 | */ 48 | s32 wldev_iovar_setbuf( 49 | struct net_device *dev, s8 *iovar_name, 50 | void *param, s32 paramlen, void *buf, s32 buflen, struct mutex* buf_sync); 51 | 52 | s32 wldev_iovar_setint( 53 | struct net_device *dev, s8 *iovar, s32 val); 54 | 55 | s32 wldev_iovar_getint( 56 | struct net_device *dev, s8 *iovar, s32 *pval); 57 | 58 | /** The following function can be implemented if there is a need for bsscfg 59 | * indexed IOVARs 60 | */ 61 | 62 | s32 wldev_mkiovar_bsscfg( 63 | const s8 *iovar_name, s8 *param, s32 paramlen, 64 | s8 *iovar_buf, s32 buflen, s32 bssidx); 65 | 66 | /** Retrieve named and bsscfg indexed IOVARs, this function calls wl_dev_ioctl with 67 | * WLC_GET_VAR IOCTL code 68 | */ 69 | s32 wldev_iovar_getbuf_bsscfg( 70 | struct net_device *dev, s8 *iovar_name, void *param, s32 paramlen, 71 | void *buf, s32 buflen, s32 bsscfg_idx, struct mutex* buf_sync); 72 | 73 | /** Set named and bsscfg indexed IOVARs, this function calls wl_dev_ioctl with 74 | * WLC_SET_VAR IOCTL code 75 | */ 76 | s32 wldev_iovar_setbuf_bsscfg( 77 | struct net_device *dev, s8 *iovar_name, void *param, s32 paramlen, 78 | void *buf, s32 buflen, s32 bsscfg_idx, struct mutex* buf_sync); 79 | 80 | s32 wldev_iovar_getint_bsscfg( 81 | struct net_device *dev, s8 *iovar, s32 *pval, s32 bssidx); 82 | 83 | s32 wldev_iovar_setint_bsscfg( 84 | struct net_device *dev, s8 *iovar, s32 val, s32 bssidx); 85 | 86 | extern void get_customized_country_code(char *country_iso_code, wl_country_t *cspec); 87 | extern void dhd_bus_country_set(struct net_device *dev, wl_country_t *cspec); 88 | extern void dhd_bus_band_set(struct net_device *dev, uint band); 89 | extern int wldev_set_country(struct net_device *dev, char *country_code); 90 | extern int net_os_wake_lock(struct net_device *dev); 91 | extern int net_os_wake_unlock(struct net_device *dev); 92 | extern int net_os_wake_lock_timeout(struct net_device *dev); 93 | extern int net_os_wake_lock_timeout_enable(struct net_device *dev, int val); 94 | extern int net_os_set_dtim_skip(struct net_device *dev, int val); 95 | extern int net_os_set_suspend_disable(struct net_device *dev, int val); 96 | extern int net_os_set_suspend(struct net_device *dev, int val, int force); 97 | extern int wl_iw_parse_ssid_list_tlv(char** list_str, wlc_ssid_t* ssid, 98 | int max, int *bytes_left); 99 | 100 | /* Get the link speed from dongle, speed is in kpbs */ 101 | int wldev_get_link_speed(struct net_device *dev, int *plink_speed); 102 | 103 | int wldev_get_rssi(struct net_device *dev, int *prssi); 104 | 105 | int wldev_get_ssid(struct net_device *dev, wlc_ssid_t *pssid); 106 | 107 | int wldev_get_band(struct net_device *dev, uint *pband); 108 | 109 | int wldev_set_band(struct net_device *dev, uint band); 110 | 111 | #endif /* __WLDEV_COMMON_H__ */ 112 | -------------------------------------------------------------------------------- /firmware/ap6210/nvram_ap6210.txt.ihex: -------------------------------------------------------------------------------- 1 | :10000000234150363231305F4E5652414D5F5631AA 2 | :100010002E325F30333139323031330D0A6D616E3B 3 | :100020006669643D30783264300D0A70726F6469BD 4 | :10003000643D30783439320D0A76656E6469643D0A 5 | :100040003078313465340D0A64657669643D307802 6 | :10005000343334330D0A626F617264747970653DB4 7 | :100060003078303539380D0A0D0A2320426F61721D 8 | :1000700064205265766973696F6E2069732050330E 9 | :1000800030372C2073616D65206E7672616D20664D 10 | :10009000696C652063616E206265207573656420FC 11 | :1000A000666F7220503330342C20503330352C2082 12 | :1000B0005033303620616E64205033303720617306 13 | :1000C0002074686520747373692070612070617298 14 | :1000D000616D732075736564206172652073616D55 15 | :1000E000650D0A23506C6561736520666F726365E8 16 | :1000F00020746865206175746F6D61746963205246 17 | :100100005820504552206461746120746F207468D7 18 | :1001100065207265737065637469766520626F61CE 19 | :100120007264206469726563746F727920696620F5 20 | :100130006E6F74207573696E67205033303720629C 21 | :100140006F6172642C20666F7220652E672E2066A8 22 | :100150006F72205033303520626F61726473206695 23 | :100160006F72636520746865206461746120696ED4 24 | :10017000746F2074686520666F6C6C6F77696E674A 25 | :10018000206469726563746F7279202F70726F6A70 26 | :10019000656374732F42434D34333336322F6131EC 27 | :1001A0005F6C6162646174612F626F617264746517 28 | :1001B0007374732F726573756C74732F7364675FD8 29 | :1001C000726576303330350D0A626F617264726524 30 | :1001D000763D3078313330370D0A626F6172646E6C 31 | :1001E000756D3D3737370D0A7874616C66726571CD 32 | :1001F0003D32363030300D0A626F617264666C6178 33 | :1002000067733D307838303230310D0A626F617279 34 | :1002100064666C616773323D307838300D0A7372F2 35 | :100220006F6D7265763D330D0A776C3069643D30D1 36 | :1002300078343331620D0A6D6163616464723D30FC 37 | :10024000303A39303A34633A30373A37313A31322A 38 | :100250000D0A616132673D310D0A6167303D320D33 39 | :100260000A6D617870326761303D37340D0A63631F 40 | :100270006B3267706F3D3078323232320D0A6F6602 41 | :10028000646D3267706F3D307834343434343434D4 42 | :10029000340D0A6D63733267706F303D30783636D7 43 | :1002A00036360D0A6D63733267706F313D307836C4 44 | :1002B0003636360D0A7061306D61787077723D3573 45 | :1002C000360D0A0D0A23503230372050412070611C 46 | :1002D00072616D730D0A2370613062303D353434C4 47 | :1002E000370D0A2370613062313D2D3635380D0AE5 48 | :1002F0002370613062323D2D3137353C6469763E82 49 | :100300003C2F6469763E0D0A0D0A2353616D65200A 50 | :10031000504120706172616D7320666F722050339E 51 | :1003200030342C503330352C20503330362C205084 52 | :100330003330370D0A0D0A70613062303D35343488 53 | :10034000370D0A70613062313D2D3630370D0A703D 54 | :10035000613062323D2D3136300D0A706130697482 55 | :10036000737369743D36320D0A7061316974737349 56 | :1003700069743D36320D0A0D0A0D0A63636B5077BE 57 | :10038000724F66667365743D350D0A63636F64650D 58 | :100390003D300D0A72737369736D6632673D307854 59 | :1003A000610D0A72737369736D6332673D30783320 60 | :1003B0000D0A7273736973617632673D3078370D59 61 | :1003C0000A747269736F32673D300D0A6E6F69731C 62 | :1003D000655F63616C5F656E61626C655F32673D2E 63 | :1003E000300D0A6E6F6973655F63616C5F706F5F7C 64 | :1003F00032673D300D0A73776374726C6D61705FA4 65 | :1004000032673D307830343034303430342C30780A 66 | :1004100030323032303230322C307830323032308C 67 | :100420003230322C30783031303130312C3078313C 68 | :1004300066660D0A74656D705F6164643D323937BC 69 | :1004400036370D0A74656D705F6D756C743D3432AE 70 | :10045000350D0A0D0A6274635F666C6167733D3027 71 | :1004600078360D0A6274635F706172616D73303D3E 72 | :10047000353030300D0A6274635F706172616D7384 73 | :10048000313D313030300D0A6274635F70617261EA 74 | :0A0490006D73363D36330D0A0D0A78 75 | :00000001FF 76 | --------------------------------------------------------------------------------