wifi: update driver to 1.579.77.41.2 (r)
authorRongjun Chen <rongjun.chen@amlogic.com>
Wed, 11 Oct 2017 09:34:35 +0000 (17:34 +0800)
committerRongjun Chen <rongjun.chen@amlogic.com>
Fri, 13 Oct 2017 03:07:18 +0000 (11:07 +0800)
PD# 151866

update wifi driver

Change-Id: Iaa65eca2adedd58cd484cfc96b3f7a3c557c6e4f
Signed-off-by: Rongjun Chen <rongjun.chen@amlogic.com>
26 files changed:
bcmdhd.1.579.77.41.1.cn/Makefile
bcmdhd.1.579.77.41.1.cn/bcmsdh_sdmmc.c
bcmdhd.1.579.77.41.1.cn/dhd.h
bcmdhd.1.579.77.41.1.cn/dhd_common.c
bcmdhd.1.579.77.41.1.cn/dhd_config.c
bcmdhd.1.579.77.41.1.cn/dhd_config.h
bcmdhd.1.579.77.41.1.cn/dhd_debug.c
bcmdhd.1.579.77.41.1.cn/dhd_gpio.c
bcmdhd.1.579.77.41.1.cn/dhd_linux.c
bcmdhd.1.579.77.41.1.cn/dhd_msgbuf.c
bcmdhd.1.579.77.41.1.cn/dhd_pcie.c
bcmdhd.1.579.77.41.1.cn/dhd_pcie.h
bcmdhd.1.579.77.41.1.cn/dhd_pcie_linux.c
bcmdhd.1.579.77.41.1.cn/dhd_rtt.c
bcmdhd.1.579.77.41.1.cn/dhd_sdio.c
bcmdhd.1.579.77.41.1.cn/dhd_static_buf.c
bcmdhd.1.579.77.41.1.cn/include/epivers.h
bcmdhd.1.579.77.41.1.cn/include/osl.h
bcmdhd.1.579.77.41.1.cn/include/wlioctl.h
bcmdhd.1.579.77.41.1.cn/wl_android.c
bcmdhd.1.579.77.41.1.cn/wl_cfg80211.c
bcmdhd.1.579.77.41.1.cn/wl_cfg80211.h
bcmdhd.1.579.77.41.1.cn/wl_cfgvendor.c
bcmdhd.1.579.77.41.1.cn/wl_escan.c
bcmdhd.1.579.77.41.1.cn/wl_escan.h
bcmdhd.1.579.77.41.1.cn/wl_iw.c

index 636497aab372bbcd88328b619a44e712d0c83172..5788bb331c4206a20c727d80a5f61f564853ce46 100644 (file)
@@ -20,8 +20,8 @@ DHDCFLAGS = -Wall -Wstrict-prototypes -Dlinux -DBCMDRIVER -DSDTEST       \
        -DWIFI_ACT_FRAME -DARP_OFFLOAD_SUPPORT -DSUPPORT_PM2_ONLY             \
        -DKEEP_ALIVE -DPKT_FILTER_SUPPORT -DPNO_SUPPORT -DDHDTCPACK_SUPPRESS  \
        -DDHD_DONOT_FORWARD_BCMEVENT_AS_NETWORK_PKT -DRXFRAME_THREAD          \
-       -DTSQ_MULTIPLIER -DMFP                                                  \
-       -DBCMSDIOH_TXGLOM_EXT -DWL_EXT_IAPSTA                           \
+       -DTSQ_MULTIPLIER -DMFP                                                \
+       -DBCMSDIOH_TXGLOM_EXT -DWL_EXT_IAPSTA                                 \
        -DENABLE_INSMOD_NO_FW_LOAD                                            \
        -I$(src) -I$(src)/include
 
@@ -117,6 +117,7 @@ DHDCFLAGS += -DWL_SUPPORT_BACKPORTED_KPATCHES
 DHDCFLAGS += -DESCAN_RESULT_PATCH
 DHDCFLAGS += -DVSDB -DWL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
 DHDCFLAGS += -DWLTDLS -DMIRACAST_AMPDU_SIZE=8
+DHDCFLAGS += -DWL_VIRTUAL_APSTA
 endif
 EXTRA_CFLAGS = $(DHDCFLAGS)
 ifeq ($(CONFIG_BCMDHD),m)
index 8cbf18a132b76e9b21ad61a3e0a918f191cc3a95..d98411f36509024cde71fa5b96f15f79ad9b8b2e 100644 (file)
@@ -190,7 +190,7 @@ sdioh_sdmmc_card_enablefuncs(sdioh_info_t *sd)
        err_ret = sdio_enable_func(sd->func[1]);
        sdio_release_host(sd->func[1]);
        if (err_ret) {
-               sd_err(("bcmsdh_sdmmc: Failed to enable F1 Err: 0x%08x", err_ret));
+               sd_err(("bcmsdh_sdmmc: Failed to enable F1 Err: 0x%08x\n", err_ret));
        }
 
        return FALSE;
@@ -1099,6 +1099,7 @@ sdioh_request_word(sdioh_info_t *sd, uint cmd_type, uint rw, uint func, uint add
        return (((err_ret == 0)&&(err_ret2 == 0)) ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL);
 }
 
+#ifdef BCMSDIOH_TXGLOM
 static SDIOH_API_RC
 sdioh_request_packet_chain(sdioh_info_t *sd, uint fix_inc, uint write, uint func,
                      uint addr, void *pkt)
@@ -1117,11 +1118,9 @@ sdioh_request_packet_chain(sdioh_info_t *sd, uint fix_inc, uint write, uint func
        uint32 sg_count;
        struct sdio_func *sdio_func = sd->func[func];
        struct mmc_host *host = sdio_func->card->host;
-#ifdef BCMSDIOH_TXGLOM
        uint8 *localbuf = NULL;
        uint local_plen = 0;
        uint pkt_len = 0;
-#endif /* BCMSDIOH_TXGLOM */
        struct timespec now, before;
 
        sd_trace(("%s: Enter\n", __FUNCTION__));
@@ -1139,11 +1138,9 @@ sdioh_request_packet_chain(sdioh_info_t *sd, uint fix_inc, uint write, uint func
        pkt_offset = 0;
        pnext = pkt;
 
-#ifdef BCMSDIOH_TXGLOM
        ttl_len = 0;
        sg_count = 0;
        if(sd->txglom_mode == SDPCM_TXGLOM_MDESC) {
-#endif
        while (pnext != NULL) {
                ttl_len = 0;
                sg_count = 0;
@@ -1231,7 +1228,6 @@ sdioh_request_packet_chain(sdioh_info_t *sd, uint fix_inc, uint write, uint func
                        return SDIOH_API_RC_FAIL;
                }
        }
-#ifdef BCMSDIOH_TXGLOM
        } else if(sd->txglom_mode == SDPCM_TXGLOM_CPY) {
                for (pnext = pkt; pnext; pnext = PKTNEXT(sd->osh, pnext)) {
                        ttl_len += PKTLEN(sd->osh, pnext);
@@ -1305,7 +1301,6 @@ txglomfail:
 
        if (localbuf)
                MFREE(sd->osh, localbuf, ttl_len);
-#endif /* BCMSDIOH_TXGLOM */
 
        if (sd_msglevel & SDH_COST_VAL) {
                getnstimeofday(&now);
@@ -1316,6 +1311,7 @@ txglomfail:
        sd_trace(("%s: Exit\n", __FUNCTION__));
        return SDIOH_API_RC_SUCCESS;
 }
+#endif /* BCMSDIOH_TXGLOM */
 
 static SDIOH_API_RC
 sdioh_buffer_tofrom_bus(sdioh_info_t *sd, uint fix_inc, uint write, uint func,
@@ -1732,15 +1728,22 @@ sdioh_gpio_init(sdioh_info_t *sd)
 uint
 sdmmc_get_clock_rate(sdioh_info_t *sd)
 {
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))
+       return 0;
+#else
        struct sdio_func *sdio_func = sd->func[0];
        struct mmc_host *host = sdio_func->card->host;
        return mmc_host_clk_rate(host);
+#endif
 }
 
 
 void
 sdmmc_set_clock_rate(sdioh_info_t *sd, uint hz)
 {
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))
+       return;
+#else
        struct sdio_func *sdio_func = sd->func[0];
        struct mmc_host *host = sdio_func->card->host;
        struct mmc_ios *ios = &host->ios;
@@ -1760,6 +1763,7 @@ sdmmc_set_clock_rate(sdioh_info_t *sd, uint hz)
        host->ops->set_ios(host, ios);
        DHD_ERROR(("%s: After change: sd clock rate is %u\n", __FUNCTION__, ios->clock));
        mmc_host_clk_release(host);
+#endif
 }
 
 void
index 99af8b3c2924c75311549a849dd37476aa044aac..0c46434c5d7a65894a5f572d174c91774f28ef47 100644 (file)
@@ -85,6 +85,10 @@ int get_scheduler_policy(struct task_struct *p);
 #define WL_VENDOR_EXT_SUPPORT
 #endif /* 3.18 > KERNEL_VER >= 3.14 || defined(CONFIG_BCMDHD_VENDOR_EXT) */
 
+/*#if !defined(WL_VENDOR_EXT_SUPPORT)
+#undef GSCAN_SUPPORT
+#endif
+*/
 #if defined(KEEP_ALIVE)
 /* Default KEEP_ALIVE Period is 55 sec to prevent AP from sending Keep Alive probe frame */
 #define KEEP_ALIVE_PERIOD 55000
@@ -106,6 +110,7 @@ enum dhd_bus_state {
        DHD_BUS_DATA,           /* Ready for frame transfers */
        DHD_BUS_SUSPEND,        /* Bus has been suspended */
        DHD_BUS_DOWN_IN_PROGRESS,       /* Bus going Down */
+       DHD_BUS_REMOVE, /* Bus has been removed */
 };
 
 /*
@@ -217,7 +222,11 @@ enum dhd_bus_state {
                 DHD_BUS_BUSY_CHECK_RPM_SUSPEND_IN_PROGRESS(dhdp))
 
 #define DHD_BUS_CHECK_DOWN_OR_DOWN_IN_PROGRESS(dhdp) \
-               ((dhdp)->busstate == DHD_BUS_DOWN || (dhdp)->busstate == DHD_BUS_DOWN_IN_PROGRESS)
+               ((dhdp)->busstate == DHD_BUS_DOWN || (dhdp)->busstate == DHD_BUS_DOWN_IN_PROGRESS || \
+               (dhdp)->busstate == DHD_BUS_REMOVE)
+
+#define DHD_BUS_CHECK_REMOVE(dhdp) \
+               ((dhdp)->busstate == DHD_BUS_REMOVE)
 
 /* Macro to print Ethernet Address as String
  * expects both arguements as (char *)
@@ -1949,7 +1958,11 @@ extern uint dhd_force_tx_queueing;
 #define WIFI_TURNON_DELAY              DEFAULT_WIFI_TURNON_DELAY
 #endif /* WIFI_TURNON_DELAY */
 
+#ifdef BCMSDIO
 #define DEFAULT_DHD_WATCHDOG_INTERVAL_MS       10 /* msec */
+#else
+#define DEFAULT_DHD_WATCHDOG_INTERVAL_MS       0 /* msec */
+#endif
 #ifndef CUSTOM_DHD_WATCHDOG_MS
 #define CUSTOM_DHD_WATCHDOG_MS                 DEFAULT_DHD_WATCHDOG_INTERVAL_MS
 #endif /* DEFAULT_DHD_WATCHDOG_INTERVAL_MS */
index adf83c22cea7d5f70291d0ee49ffb45d091ed827..19a9226ecd2cc1bbdc9de926627af7052013b55d 100644 (file)
@@ -207,7 +207,7 @@ bool ap_fw_loaded = FALSE;
 #if defined(DHD_DEBUG)
 const char dhd_version[] = "Dongle Host Driver, version " EPI_VERSION_STR;
 #else
-const char dhd_version[] = "\nDongle Host Driver, version " EPI_VERSION_STR "\nCompiled from ";
+const char dhd_version[] = "\nDongle Host Driver, version " EPI_VERSION_STR;
 #endif 
 char fw_version[FW_VER_STR_LEN] = "\0";
 char clm_version[CLM_VER_STR_LEN] = "\0";
@@ -1171,6 +1171,7 @@ dhd_mw_list_delete(dhd_pub_t *dhd, dll_t *list_head)
 extern pkt_statics_t tx_statics;
 extern void dhdsdio_txpktstatics(void);
 #endif
+
 static int
 dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, uint32 actionid, const char *name,
             void *params, int plen, void *arg, int len, int val_size)
@@ -2319,13 +2320,14 @@ dhd_ioctl(dhd_pub_t * dhd_pub, dhd_ioctl_t *ioc, void *buf, uint buflen)
                                                bcmstricmp((char *)buf, "pciecfgreg") &&
                                                bcmstricmp((char *)buf, "devreset") &&
                                                bcmstricmp((char *)buf, "sdio_suspend") &&
-                                               bcmstricmp((char *)buf, "control_signal")) {
+                                               bcmstricmp((char *)buf, "control_signal"))
 #else
                                        if (bcmstricmp((char *)buf, "pcie_suspend") &&
                                            bcmstricmp((char *)buf, "pciecfgreg") &&
                                            bcmstricmp((char *)buf, "devreset") &&
-                                           bcmstricmp((char *)buf, "sdio_suspend")) {
+                                           bcmstricmp((char *)buf, "sdio_suspend"))
 #endif /* DHD_EFI */
+                                       {
                                                DHD_ERROR(("%s: bus is in suspend(%d)"
                                                        "or suspending(0x%x) state\n",
                                                        __FUNCTION__, dhd_pub->busstate,
@@ -3855,6 +3857,7 @@ dhd_ndo_add_ip(dhd_pub_t *dhd, char* ipv6addr, int idx)
 
        return retcode;
 }
+
 /*
  * Neighbor Discover Offload: enable NDO feature
  * Called  by ipv6 event handler when interface goes down
@@ -5828,6 +5831,7 @@ fail:
        }
 
 }
+
 #ifdef PCIE_FULL_DONGLE
 int
 dhd_event_logtrace_infobuf_pkt_process(dhd_pub_t *dhdp, void *pktbuf,
index 1e535fea4b5eb3c87aef449fc0b3de322b0f392a..700573ffaa1f7c42ac41f9922f3b4f6b051fb9b9 100644 (file)
@@ -492,8 +492,11 @@ dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path)
                        if (chiprev == BCM4339A0_CHIP_REV)\r
                                strcpy(&fw_path[i+1], FW_BCM4339A0);\r
                        break;\r
-               case BCM4345_CHIP_ID:\r
                case BCM43454_CHIP_ID:\r
+                       if (chiprev == BCM43455C0_CHIP_REV)\r
+                               strcpy(&fw_path[i+1], FW_BCM43455C0);\r
+                       break;\r
+               case BCM4345_CHIP_ID:\r
                        if (chiprev == BCM43455C0_CHIP_REV)\r
                                strcpy(&fw_path[i+1], FW_BCM43455C0);\r
                        else if (chiprev == BCM43455C5_CHIP_REV)\r
@@ -1934,7 +1937,7 @@ dhd_conf_read_sdio_params(dhd_pub_t *dhd, char *full_param, uint len_param)
                printf("%s: dhd_slpauto = %d\n", __FUNCTION__, dhd_slpauto);\r
        }\r
        else if (!strncmp("kso_enable=", full_param, len_param)) {\r
-               if (!strncmp(data, "1", 1))\r
+               if (!strncmp(data, "0", 1))\r
                        dhd_slpauto = FALSE;\r
                else\r
                        dhd_slpauto = TRUE;\r
@@ -2016,10 +2019,7 @@ dhd_conf_read_sdio_params(dhd_pub_t *dhd, char *full_param, uint len_param)
                printf("%s: deferred_tx_len = %d\n", __FUNCTION__, conf->deferred_tx_len);\r
        }\r
        else if (!strncmp("txctl_tmo_fix=", full_param, len_param)) {\r
-               if (!strncmp(data, "0", 1))\r
-                       conf->txctl_tmo_fix = FALSE;\r
-               else\r
-                       conf->txctl_tmo_fix = TRUE;\r
+               conf->txctl_tmo_fix = (int)simple_strtol(data, NULL, 10);\r
                printf("%s: txctl_tmo_fix = %d\n", __FUNCTION__, conf->txctl_tmo_fix);\r
        }\r
        else if (!strncmp("tx_in_rx=", full_param, len_param)) {\r
@@ -2503,7 +2503,7 @@ dhd_conf_preinit(dhd_pub_t *dhd)
 #endif\r
        conf->srl = -1;\r
        conf->lrl = -1;\r
-       conf->bcn_timeout = 15;\r
+       conf->bcn_timeout = 16;\r
        conf->spect = -1;\r
        conf->txbf = -1;\r
        conf->lpc = -1;\r
@@ -2516,7 +2516,7 @@ dhd_conf_preinit(dhd_pub_t *dhd)
        conf->tx_max_offset = 0;\r
        conf->txglomsize = SDPCM_DEFGLOM_SIZE;\r
        conf->dhd_poll = -1;\r
-       conf->txctl_tmo_fix = TRUE;\r
+       conf->txctl_tmo_fix = 5;\r
        conf->tx_in_rx = TRUE;\r
        conf->txglom_mode = SDPCM_TXGLOM_MDESC;\r
        conf->deferred_tx_len = 0;\r
@@ -2541,7 +2541,7 @@ dhd_conf_preinit(dhd_pub_t *dhd)
        conf->dhcpc_enable = -1;\r
        conf->dhcpd_enable = -1;\r
 #endif\r
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0))\r
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0))\r
        conf->tsq = 10;\r
 #else\r
        conf->tsq = 0;\r
@@ -2574,7 +2574,7 @@ dhd_conf_preinit(dhd_pub_t *dhd)
 #ifdef BCMSDIO\r
                conf->dhd_txminmax = -1;\r
                conf->txinrx_thres = 128;\r
-               conf->sd_f2_blocksize = 256;\r
+               conf->sd_f2_blocksize = CUSTOM_SDIO_F2_BLKSIZE;\r
                conf->oob_enabled_later = TRUE;\r
 #ifdef CUSTOMER_HW_AMLOGIC\r
                conf->rxf_cpucore = 2;\r
@@ -2606,7 +2606,7 @@ dhd_conf_preinit(dhd_pub_t *dhd)
 #endif\r
        if (conf->txglomsize > SDPCM_MAXGLOM_SIZE)\r
                conf->txglomsize = SDPCM_MAXGLOM_SIZE;\r
-       conf->deferred_tx_len = conf->txglomsize;\r
+       conf->deferred_tx_len = 0;\r
 #endif\r
 \r
        return 0;\r
index af10705d5b5cc4343dcf7705aa4db4fc616183e1..5fdd538a0b8b65cf403e1da83b134e9bd525ed8e 100644 (file)
@@ -149,7 +149,7 @@ typedef struct dhd_conf {
        int tx_max_offset;
        uint txglomsize;
        int dhd_poll;
-       bool txctl_tmo_fix;
+       int txctl_tmo_fix;
        bool tx_in_rx;
        bool txglom_mode;
        uint deferred_tx_len;
@@ -211,6 +211,7 @@ void dhd_conf_set_nv_name_by_mac(dhd_pub_t *dhd, bcmsdh_info_t *sdh, char *nv_pa
 void dhd_conf_set_hw_oob_intr(bcmsdh_info_t *sdh, uint chip);
 #endif
 void dhd_conf_set_txglom_params(dhd_pub_t *dhd, bool enable);
+int dhd_conf_set_blksize(bcmsdh_info_t *sdh);
 #endif
 void dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path);
 void dhd_conf_set_clm_name_by_chip(dhd_pub_t *dhd, char *clm_path);
@@ -244,7 +245,6 @@ int dhd_conf_get_disable_proptx(dhd_pub_t *dhd);
 #endif
 int dhd_conf_get_ap_mode_in_suspend(dhd_pub_t *dhd);
 int dhd_conf_set_ap_in_suspend(dhd_pub_t *dhd, int suspend);
-int dhd_conf_set_blksize(bcmsdh_info_t *sdh);
 int dhd_conf_preinit(dhd_pub_t *dhd);
 int dhd_conf_reset(dhd_pub_t *dhd);
 int dhd_conf_attach(dhd_pub_t *dhd);
index c5c1e59016779c6f6e8ba537d0ed4bd952c9e28e..23e5b46a5b9b80572c3409ee60d9cf8b7536172c 100644 (file)
@@ -1174,7 +1174,7 @@ dhd_dbg_ring_init(dhd_pub_t *dhdp, dhd_dbg_ring_t *ring, uint16 id, uint8 *name,
        void *buf;
        unsigned long flags;
 #ifdef CONFIG_DHD_USE_STATIC_BUF
-       buf = bcm_wlan_prealloc(section, ring_sz);
+       buf = DHD_OS_PREALLOC(dhdp, section, ring_sz);
 #else
        buf = MALLOCZ(dhdp->osh, ring_sz);
 #endif
@@ -2041,7 +2041,12 @@ dhd_dbg_monitor_get_tx_pkts(dhd_pub_t *dhdp, void __user *user_buf,
        pkt_count = MIN(req_count, tx_report->status_pos);
 
 #ifdef CONFIG_COMPAT
-       if (is_compat_task()) {
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0))
+       if (in_compat_syscall())
+#else
+       if (is_compat_task())
+#endif
+       {
                cptr = (compat_wifi_tx_report_t *)user_buf;
                while ((count < pkt_count) && tx_pkt && cptr) {
                        compat_wifi_tx_report_t *comp_ptr = compat_ptr((uintptr_t) cptr);
@@ -2132,7 +2137,12 @@ dhd_dbg_monitor_get_rx_pkts(dhd_pub_t *dhdp, void __user *user_buf,
        pkt_count = MIN(req_count, rx_report->pkt_pos);
 
 #ifdef CONFIG_COMPAT
-       if (is_compat_task()) {
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0))
+       if (in_compat_syscall())
+#else
+       if (is_compat_task())
+#endif
+       {
                cptr = (compat_wifi_rx_report_t *)user_buf;
                while ((count < pkt_count) && rx_pkt && cptr) {
                        compat_wifi_rx_report_t *comp_ptr = compat_ptr((uintptr_t) cptr);
index a438a27da1a77670f9af8dbec6bae3140a890943..78537c88252e83a1765aae1b9dce7549a43303ae 100644 (file)
 #include <linux/mmc/sdio_func.h>
 #endif /* defined(BUS_POWER_RESTORE) && defined(BCMSDIO) */
 
+
+static int gpio_wl_reg_on = -1; // WL_REG_ON is input pin of WLAN module
+#ifdef CUSTOMER_OOB
+static int gpio_wl_host_wake = -1; // WL_HOST_WAKE is output pin of WLAN module
+#endif
+
 #ifdef CUSTOMER_HW_AMLOGIC
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0))
 #include <linux/amlogic/aml_gpio_consumer.h>
@@ -28,12 +34,6 @@ extern int wifi_irq_num(void);
 #endif
 #endif
 
-
-static int gpio_wl_reg_on = -1; // WL_REG_ON is input pin of WLAN module
-#ifdef CUSTOMER_OOB
-static int gpio_wl_host_wake = -1; // WL_HOST_WAKE is output pin of WLAN module
-#endif
-
 static int
 dhd_wlan_set_power(int on
 #ifdef BUS_POWER_RESTORE
@@ -206,14 +206,6 @@ void* bcm_wlan_prealloc(int section, unsigned long size)
 }
 #endif
 
-//#if !defined(WL_WIRELESS_EXT)
-//struct cntry_locales_custom {
-//     char iso_abbrev[WLC_CNTRY_BUF_SZ];      /* ISO 3166-1 country abbreviation */
-//     char custom_locale[WLC_CNTRY_BUF_SZ];   /* Custom firmware locale */
-//     int32 custom_locale_rev;                /* Custom local revisin default -1 */
-//};
-//#endif
-
 static struct cntry_locales_custom brcm_wlan_translate_custom_table[] = {
        /* Table should be filled out based on custom platform regulatory requirement */
        {"",   "XT", 49},  /* Universal if Country code is unknown or empty */
index 7d08eb2971be04ae5a58faabd90f92e87c95fa5b..6e94bfc94ad65efb859b46976f9b32f9c48760ab 100644 (file)
@@ -3559,10 +3559,11 @@ static int dhd_set_suspend(int value, dhd_pub_t *dhd)
                        }
 #endif /* NDO_CONFIG_SUPPORT */
 #ifndef APF
-                       if (FW_SUPPORTED(dhd, ndoe)) {
+                       if (FW_SUPPORTED(dhd, ndoe))
 #else
-                       if (FW_SUPPORTED(dhd, ndoe) && !FW_SUPPORTED(dhd, apf)) {
+                       if (FW_SUPPORTED(dhd, ndoe) && !FW_SUPPORTED(dhd, apf))
 #endif /* APF */
+                       {
                                /* enable IPv6 RA filter in  firmware during suspend */
                                nd_ra_filter = 1;
                                ret = dhd_iovar(dhd, 0, "nd_ra_filter_enable",
@@ -3643,8 +3644,11 @@ static int dhd_set_suspend(int value, dhd_pub_t *dhd)
 #endif /* PASS_ALL_MCAST_PKTS */
 #if defined(BCMPCIE)
                        /* restore pre-suspend setting */
-                       dhd_iovar(dhd, 0, "bcn_li_dtim", (char *)&bcn_li_dtim,
+                       ret = dhd_iovar(dhd, 0, "bcn_li_dtim", (char *)&bcn_li_dtim,
                                        sizeof(bcn_li_dtim), NULL, 0, TRUE);
+                       if (ret < 0) {
+                               DHD_ERROR(("%s:bcn_li_ditm fail:%d\n", __FUNCTION__, ret));
+                       }
 
                        dhd_iovar(dhd, 0, "lpas", (char *)&lpas, sizeof(lpas), NULL, 0,
                                        TRUE);
@@ -3695,10 +3699,11 @@ static int dhd_set_suspend(int value, dhd_pub_t *dhd)
                        }
 #endif /* NDO_CONFIG_SUPPORT */
 #ifndef APF
-                       if (FW_SUPPORTED(dhd, ndoe)) {
+                       if (FW_SUPPORTED(dhd, ndoe))
 #else
-                       if (FW_SUPPORTED(dhd, ndoe) && !FW_SUPPORTED(dhd, apf)) {
+                       if (FW_SUPPORTED(dhd, ndoe) && !FW_SUPPORTED(dhd, apf))
 #endif /* APF */
+                       {
                                /* disable IPv6 RA filter in  firmware during suspend */
                                nd_ra_filter = 0;
                                ret = dhd_iovar(dhd, 0, "nd_ra_filter_enable",
@@ -5062,7 +5067,7 @@ dhd_start_xmit(struct sk_buff *skb, struct net_device *net)
                        __FUNCTION__, dhd->pub.up, dhd->pub.busstate));
                netif_stop_queue(net);
                /* Send Event when bus down detected during data session */
-               if (dhd->pub.up && !dhd->pub.hang_was_sent) {
+               if (dhd->pub.up && !dhd->pub.hang_was_sent && !DHD_BUS_CHECK_REMOVE(&dhd->pub)) {
                        DHD_ERROR(("%s: Event HANG sent up\n", __FUNCTION__));
                        dhd->pub.hang_reason = HANG_REASON_BUS_DOWN;
                        net_os_send_hang_message(net);
@@ -6016,11 +6021,12 @@ dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *pktbuf, int numpkt, uint8 chan)
                        ASSERT(ifidx < DHD_MAX_IFS && dhd->iflist[ifidx]);
                        ifp = dhd->iflist[ifidx];
 #ifndef PROP_TXSTATUS_VSDB
-                       if (!(ifp && ifp->net && (ifp->net->reg_state == NETREG_REGISTERED))) {
+                       if (!(ifp && ifp->net && (ifp->net->reg_state == NETREG_REGISTERED)))
 #else
                        if (!(ifp && ifp->net && (ifp->net->reg_state == NETREG_REGISTERED) &&
-                               dhd->pub.up)) {
+                               dhd->pub.up))
 #endif /* PROP_TXSTATUS_VSDB */
+                       {
                                DHD_ERROR(("%s: net device is NOT registered. drop event packet\n",
                                __FUNCTION__));
 #ifdef DHD_USE_STATIC_CTRLBUF
@@ -8280,12 +8286,23 @@ dhd_open(struct net_device *net)
                        DHD_ERROR(("%s: WLAN driver is not initialized\n", __FUNCTION__));
                        return -1;
                }
-               /* Init wakelock */
+       }
+
+       printf("%s: Enter %p\n", __FUNCTION__, net);
+#if defined(MULTIPLE_SUPPLICANT)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1
+       if (mutex_is_locked(&_dhd_sdio_mutex_lock_) != 0) {
+               DHD_ERROR(("%s : dhd_open: call dev open before insmod complete!\n", __FUNCTION__));
+       }
+       mutex_lock(&_dhd_sdio_mutex_lock_);
+#endif
+#endif /* MULTIPLE_SUPPLICANT */
+       /* Init wakelock */
+       if (!dhd_download_fw_on_driverload) {
                if (!(dhd->dhd_state & DHD_ATTACH_STATE_WAKELOCKS_INIT)) {
                        DHD_OS_WAKE_LOCK_INIT(dhd);
                        dhd->dhd_state |= DHD_ATTACH_STATE_WAKELOCKS_INIT;
                }
-
 #ifdef SHOW_LOGTRACE
                skb_queue_head_init(&dhd->evt_trace_queue);
 
@@ -8300,15 +8317,6 @@ dhd_open(struct net_device *net)
                        }
                }
 #endif /* SHOW_LOGTRACE */
-       printf("%s: Enter %p\n", __FUNCTION__, net);
-#if defined(MULTIPLE_SUPPLICANT)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1
-       if (mutex_is_locked(&_dhd_sdio_mutex_lock_) != 0) {
-               DHD_ERROR(("%s : dhd_open: call dev open before insmod complete!\n", __FUNCTION__));
-       }
-       mutex_lock(&_dhd_sdio_mutex_lock_);
-#endif
-#endif /* MULTIPLE_SUPPLICANT */
        }
 
 #if defined(PREVENT_REOPEN_DURING_HANG)
@@ -9387,7 +9395,7 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
                dhd_state |= DHD_ATTACH_STATE_WL_ATTACH;
        }
 #ifdef WL_ESCAN
-       wl_escan_attach(net, (void *)&dhd->pub);
+       wl_escan_attach(net, &dhd->pub);
 #endif /* WL_ESCAN */
 #endif /* defined(WL_WIRELESS_EXT) */
 
@@ -12635,7 +12643,7 @@ void dhd_detach(dhd_pub_t *dhdp)
                wl_iw_detach();
        }
 #ifdef WL_ESCAN
-       wl_escan_detach();
+       wl_escan_detach(dhdp);
 #endif /* WL_ESCAN */
 #endif /* defined(WL_WIRELESS_EXT) */
 
@@ -13301,6 +13309,7 @@ dhd_os_d3ack_wake(dhd_pub_t *pub)
        wake_up(&dhd->d3ack_wait);
        return 0;
 }
+
 int
 dhd_os_busbusy_wait_negation(dhd_pub_t *pub, uint *condition)
 {
@@ -13494,6 +13503,8 @@ dhd_os_open_image(char *filename)
                 goto err;
         }
 
+        DHD_ERROR(("%s: %s (%d bytes) open success\n", __FUNCTION__, filename, size));
+
 err:
         return fp;
 }
@@ -14187,6 +14198,7 @@ dhd_dev_get_feature_set_matrix(struct net_device *dev, int num)
 
        return ret;
 }
+
 #ifdef CUSTOM_FORCE_NODFS_FLAG
 int
 dhd_dev_set_nodfs(struct net_device *dev, u32 nodfs)
@@ -14448,6 +14460,7 @@ dhd_dev_pno_stop_for_ssid(struct net_device *dev)
 
        return (dhd_pno_stop_for_ssid(&dhd->pub));
 }
+
 /* Linux wrapper to call common dhd_pno_set_for_ssid */
 int
 dhd_dev_pno_set_for_ssid(struct net_device *dev, wlc_ssid_ext_t* ssids_local, int nssid,
@@ -14483,6 +14496,7 @@ dhd_dev_pno_stop_for_batch(struct net_device *dev)
        dhd_info_t *dhd = DHD_DEV_INFO(dev);
        return (dhd_pno_stop_for_batch(&dhd->pub));
 }
+
 /* Linux wrapper to call common dhd_dev_pno_set_for_batch */
 int
 dhd_dev_pno_set_for_batch(struct net_device *dev, struct dhd_pno_batch_params *batch_params)
@@ -14490,6 +14504,7 @@ dhd_dev_pno_set_for_batch(struct net_device *dev, struct dhd_pno_batch_params *b
        dhd_info_t *dhd = DHD_DEV_INFO(dev);
        return (dhd_pno_set_for_batch(&dhd->pub, batch_params));
 }
+
 /* Linux wrapper to call common dhd_dev_pno_get_for_batch */
 int
 dhd_dev_pno_get_for_batch(struct net_device *dev, char *buf, int bufsize)
@@ -14628,6 +14643,7 @@ dhd_dev_retrieve_batch_scan(struct net_device *dev)
 
        return (dhd_retreive_batch_scan_results(&dhd->pub));
 }
+
 /* Linux wrapper to call common dhd_pno_process_epno_result */
 void * dhd_dev_process_epno_result(struct net_device *dev,
        const void  *data, uint32 event, int *send_evt_bytes)
@@ -14695,6 +14711,7 @@ dhd_dev_lazy_roam_enable(struct net_device *dev, uint32 enable)
        }
        return err;
 }
+
 int
 dhd_dev_set_lazy_roam_bssid_pref(struct net_device *dev,
        wl_bssid_pref_cfg_t *bssid_pref, uint32 flush)
@@ -14715,6 +14732,7 @@ dhd_dev_set_lazy_roam_bssid_pref(struct net_device *dev,
        }
        return err;
 }
+
 int
 dhd_dev_set_blacklist_bssid(struct net_device *dev, maclist_t *blacklist,
     uint32 len, uint32 flush)
@@ -14740,6 +14758,7 @@ dhd_dev_set_blacklist_bssid(struct net_device *dev, maclist_t *blacklist,
        }
        return err;
 }
+
 int
 dhd_dev_set_whitelist_ssid(struct net_device *dev, wl_ssid_whitelist_t *ssid_whitelist,
     uint32 len, uint32 flush)
@@ -14767,6 +14786,7 @@ dhd_dev_set_whitelist_ssid(struct net_device *dev, wl_ssid_whitelist_t *ssid_whi
        return err;
 }
 #endif /* GSCAN_SUPPORT */
+
 #if defined(GSCAN_SUPPORT) || defined(DHD_GET_VALID_CHANNELS)
 /* Linux wrapper to call common dhd_pno_get_gscan */
 void *
@@ -17475,23 +17495,21 @@ int dhd_set_ap_isolate(dhd_pub_t *dhdp, uint32 idx, int val)
 #elif (defined(BOARD_PANDA) || defined(__ARM_ARCH_7A__))
 #define MEMDUMPINFO "/data/misc/wifi/.memdump.info"
 #else
-#if defined(CONFIG_X86)
-#define MEMDUMPINFO MEMDUMPINFO_LIVE
-#endif
+#define MEMDUMPINFO "/data/misc/wifi/.memdump.info"
 #endif /* CUSTOMER_HW4_DEBUG */
 
 void dhd_get_memdump_info(dhd_pub_t *dhd)
 {
+       struct file *fp = NULL;
        uint32 mem_val = DUMP_MEMFILE_MAX;
-#if defined(CONFIG_X86)
        int ret = 0;
-       struct file *fp = NULL;
        char *filepath = MEMDUMPINFO;
+
        /* Read memdump info from the file */
        fp = filp_open(filepath, O_RDONLY, 0);
-
        if (IS_ERR(fp)) {
                DHD_ERROR(("%s: File [%s] doesn't exist\n", __FUNCTION__, filepath));
+#if defined(CONFIG_X86)
                /* Check if it is Live Brix Image */
                if (strcmp(filepath, MEMDUMPINFO_LIVE) != 0) {
                        goto done;
@@ -17507,7 +17525,6 @@ void dhd_get_memdump_info(dhd_pub_t *dhd)
 #else /* Non Brix Android platform */
                goto done;
 #endif /* CONFIG_X86 && OEM_ANDROID */
-#if defined(CONFIG_X86)
        }
 
        /* Handle success case */
@@ -17521,7 +17538,7 @@ void dhd_get_memdump_info(dhd_pub_t *dhd)
        mem_val = bcm_atoi((char *)&mem_val);
 
        filp_close(fp, NULL);
-#endif
+
 #ifdef DHD_INIT_DEFAULT_MEMDUMP
        if (mem_val == 0 || mem_val == DUMP_MEMFILE_MAX)
                mem_val = DUMP_MEMFILE_BUGON;
@@ -17531,7 +17548,7 @@ done:
 #ifdef CUSTOMER_HW4_DEBUG
        dhd->memdump_enabled = (mem_val < DUMP_MEMFILE_MAX) ? mem_val : DUMP_DISABLED;
 #else
-       dhd->memdump_enabled = (mem_val < DUMP_MEMFILE_MAX) ? mem_val : DUMP_MEMFILE_BUGON;
+       dhd->memdump_enabled = (mem_val < DUMP_MEMFILE_MAX) ? mem_val : DUMP_MEMFILE;
 #endif /* CUSTOMER_HW4_DEBUG */
 
        DHD_ERROR(("%s: MEMDUMP ENABLED = %d\n", __FUNCTION__, dhd->memdump_enabled));
@@ -17567,6 +17584,7 @@ void dhd_schedule_memdump(dhd_pub_t *dhdp, uint8 *buf, uint32 size)
        dhd_deferred_schedule_work(dhdp->info->dhd_deferred_wq, (void *)dump,
                DHD_WQ_WORK_SOC_RAM_DUMP, dhd_mem_dump, DHD_WQ_WORK_PRIORITY_HIGH);
 }
+
 static void
 dhd_mem_dump(void *handle, void *event_info, u8 event)
 {
index 83b56ed2e7cd8c63912c30e4ce59907dad2810dc..e602d24f2e6afc6ced4e5b4ce977896c0c9d3e3b 100644 (file)
@@ -2283,11 +2283,11 @@ dhd_prot_attach(dhd_pub_t *dhd)
        /* Scratch buffer for dma rx offset */
 #ifdef BCM_HOST_BUF
        if (dhd_dma_buf_alloc(dhd, &prot->d2h_dma_scratch_buf,
-               ROUNDUP(DMA_D2H_SCRATCH_BUF_LEN, 16) + DMA_HOST_BUFFER_LEN)) {
+               ROUNDUP(DMA_D2H_SCRATCH_BUF_LEN, 16) + DMA_HOST_BUFFER_LEN))
 #else
-       if (dhd_dma_buf_alloc(dhd, &prot->d2h_dma_scratch_buf, DMA_D2H_SCRATCH_BUF_LEN)) {
-
+       if (dhd_dma_buf_alloc(dhd, &prot->d2h_dma_scratch_buf, DMA_D2H_SCRATCH_BUF_LEN))
 #endif /* BCM_HOST_BUF */
+       {
                goto fail;
        }
 
@@ -8314,12 +8314,14 @@ dhd_prot_debug_info_print(dhd_pub_t *dhd)
                        PCIECFGREG_PHY_DBG_CLKREQ3,
                        dhd_pcie_corereg_read(dhd->bus->sih, PCIECFGREG_PHY_DBG_CLKREQ3)));
 
+#if defined(PCIE_RC_VENDOR_ID) && defined(PCIE_RC_DEVICE_ID)
                DHD_ERROR(("Pcie RC Error Status Val=0x%x\n",
                        dhdpcie_rc_access_cap(dhd->bus, PCIE_EXTCAP_ID_ERR,
                        PCIE_EXTCAP_AER_UCERR_OFFSET, TRUE, FALSE, 0)));
 
                DHD_ERROR(("RootPort PCIe linkcap=0x%08x\n",
                        dhd_debug_get_rc_linkcap(dhd->bus)));
+#endif
 
                DHD_ERROR(("\n ------- DUMPING INTR enable/disable counters  ------- \r\n"));
                DHD_ERROR(("resume_intr_enable_count=%lu dpc_intr_enable_count=%lu\n"
index 48014bfa0fd650a90d17c2b2c55a10eb14a7d227..77995b585d2755ef85223427fe7b2a1e5aa73f73 100644 (file)
@@ -1116,6 +1116,27 @@ dhdpcie_advertise_bus_cleanup(dhd_pub_t   *dhdp)
        return;
 }
 
+static void
+dhdpcie_advertise_bus_remove(dhd_pub_t  *dhdp)
+{
+       unsigned long flags;
+       int timeleft;
+
+       DHD_GENERAL_LOCK(dhdp, flags);
+       dhdp->busstate = DHD_BUS_REMOVE;
+       DHD_GENERAL_UNLOCK(dhdp, flags);
+
+       timeleft = dhd_os_busbusy_wait_negation(dhdp, &dhdp->dhd_bus_busy_state);
+       if ((timeleft == 0) || (timeleft == 1)) {
+               DHD_ERROR(("%s : Timeout due to dhd_bus_busy_state=0x%x\n",
+                               __FUNCTION__, dhdp->dhd_bus_busy_state));
+               ASSERT(0);
+       }
+
+       return;
+}
+
+
 static void
 dhdpcie_bus_remove_prep(dhd_bus_t *bus)
 {
@@ -1169,7 +1190,7 @@ dhdpcie_bus_release(dhd_bus_t *bus)
                ASSERT(osh);
 
                if (bus->dhd) {
-                       dhdpcie_advertise_bus_cleanup(bus->dhd);
+                       dhdpcie_advertise_bus_remove(bus->dhd);
                        dongle_isolation = bus->dhd->dongle_isolation;
                        bus->dhd->is_pcie_watchdog_reset = FALSE;
                        dhdpcie_bus_remove_prep(bus);
@@ -1763,9 +1784,10 @@ dhdpcie_download_code_file(struct dhd_bus *bus, char *pfw_path)
 err:
        if (memblock) {
                MFREE(bus->dhd->osh, memblock, MEMBLOCK + DHD_SDALIGN);
-       if (dhd_msg_level & DHD_TRACE_VAL) {
-               if (memptr_tmp)
-                       MFREE(bus->dhd->osh, memptr_tmp, MEMBLOCK + DHD_SDALIGN);
+               if (dhd_msg_level & DHD_TRACE_VAL) {
+                       if (memptr_tmp)
+                               MFREE(bus->dhd->osh, memptr_tmp, MEMBLOCK + DHD_SDALIGN);
+               }
        }
 
        if (imgbuf) {
@@ -3937,6 +3959,7 @@ done:
 
        return bcmerror;
 }
+
 static int
 dhdpcie_bus_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, uint32 actionid, const char *name,
                 void *params, int plen, void *arg, int len, int val_size)
index 96f8462ba78ad4fb58927127f3b7b1bf115c8acc..eb8de62956bf3ffaf1b2b873419a8868b7042994 100644 (file)
@@ -509,8 +509,6 @@ extern void dhd_os_ib_set_device_wake(struct dhd_bus *bus, bool val);
 #elif defined(CONFIG_ARCH_TEGRA)
 #define PCIE_RC_VENDOR_ID TEGRA_PCIE_VENDOR_ID
 #define PCIE_RC_DEVICE_ID TEGRA_PCIE_DEVICE_ID
-#else
-#error "Not supported platform"
 #endif /* CONFIG_ARCH_EXYNOS */
 
 #ifdef USE_EXYNOS_PCIE_RC_PMPATCH
index 44b3fe93ae40832843a03376e59f0c7f4dc03c46..51664a7e217b0a34faf7d39afe8c99f91fbde99f 100644 (file)
@@ -678,6 +678,7 @@ static int dhdpcie_suspend_host_dev(dhd_bus_t *bus)
        return bcmerror;
 }
 
+#if defined(PCIE_RC_VENDOR_ID) && defined(PCIE_RC_DEVICE_ID)
 uint32
 dhdpcie_rc_config_read(dhd_bus_t *bus, uint offset)
 {
@@ -784,6 +785,7 @@ uint32 dhd_debug_get_rc_linkcap(dhd_bus_t *bus)
        linkcap &= PCIE_CAP_LINKCAP_LNKSPEED_MASK;
        return linkcap;
 }
+#endif
 
 int dhdpcie_pci_suspend_resume(dhd_bus_t *bus, bool state)
 {
@@ -808,10 +810,11 @@ int dhdpcie_pci_suspend_resume(dhd_bus_t *bus, bool state)
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
 #if defined(DHD_HANG_SEND_UP_TEST)
                if (bus->is_linkdown ||
-                       bus->dhd->req_hang_type == HANG_REASON_PCIE_RC_LINK_UP_FAIL) {
+                       bus->dhd->req_hang_type == HANG_REASON_PCIE_RC_LINK_UP_FAIL)
 #else /* DHD_HANG_SEND_UP_TEST */
-               if (bus->is_linkdown) {
+               if (bus->is_linkdown)
 #endif /* DHD_HANG_SEND_UP_TEST */
+               {
                        bus->dhd->hang_reason = HANG_REASON_PCIE_RC_LINK_UP_FAIL;
                        dhd_os_send_hang_message(bus->dhd);
                }
@@ -1346,7 +1349,11 @@ int dhdpcie_init(struct pci_dev *pdev)
                bus->is_linkdown = 0;
 
                /* Get RC Device Handle */
+#if defined(PCIE_RC_VENDOR_ID) && defined(PCIE_RC_DEVICE_ID)
                bus->rc_dev = pci_get_device(PCIE_RC_VENDOR_ID, PCIE_RC_DEVICE_ID, NULL);
+#else
+               bus->rc_dev = NULL;
+#endif
 
 #if defined(BCMPCIE_OOB_HOST_WAKE) && defined(CUSTOMER_HW2) && \
        defined(CONFIG_ARCH_APQ8084)
index 95cd7513235e9f49f7b2fb4299f2b9a173e8d7e3..c58ca93fc435e07d146b66ee069c8aa4ac7ce793 100644 (file)
@@ -75,13 +75,6 @@ static DEFINE_SPINLOCK(noti_list_lock);
 #define FTM_DEFAULT_CNT_40M            10
 #define FTM_DEFAULT_CNT_80M            5
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0))
-#define ieee80211_band nl80211_band
-#define IEEE80211_BAND_2GHZ NL80211_BAND_2GHZ
-#define IEEE80211_BAND_5GHZ NL80211_BAND_5GHZ
-#define IEEE80211_NUM_BANDS NUM_NL80211_BANDS
-#endif
-
 /* convenience macros */
 #define FTM_TU2MICRO(_tu) ((uint64)(_tu) << 10)
 #define FTM_MICRO2TU(_tu) ((uint64)(_tu) >> 10)
index c20bac9c42ef9bf0432b7d01ceeb77a4d678004d..1dcdd281afc219c06bb6580f71332756b2c9807b 100644 (file)
@@ -720,6 +720,7 @@ static int dhd_bcmsdh_send_buffer(void *bus, uint8 *frame, uint16 len);
 static int dhdsdio_set_sdmode(dhd_bus_t *bus, int32 sd_mode);
 static int dhdsdio_sdclk(dhd_bus_t *bus, bool on);
 static void dhdsdio_advertise_bus_cleanup(dhd_pub_t *dhdp);
+static void dhdsdio_advertise_bus_remove(dhd_pub_t *dhdp);
 #ifdef SUPPORT_MULTIPLE_BOARD_REV_FROM_DT
 int dhd_get_system_rev(void);
 #endif /* SUPPORT_MULTIPLE_BOARD_REV_FROM_DT */
@@ -2713,6 +2714,7 @@ dhd_bus_txctl(struct dhd_bus *bus, uchar *msg, uint msglen)
        uint8 doff = 0;
        int ret = -1;
        uint8 sdpcm_hdrlen = bus->txglom_enable ? SDPCM_HDRLEN_TXGLOM : SDPCM_HDRLEN;
+       int cnt = 0;
 
        DHD_TRACE(("%s: Enter\n", __FUNCTION__));
 
@@ -2752,7 +2754,17 @@ dhd_bus_txctl(struct dhd_bus *bus, uchar *msg, uint msglen)
 
 
        /* Need to lock here to protect txseq and SDIO tx calls */
+retry:
        dhd_os_sdlock(bus->dhd);
+       if (cnt < bus->dhd->conf->txctl_tmo_fix && !TXCTLOK(bus)) {
+               cnt++;
+               dhd_os_sdunlock(bus->dhd);
+               OSL_SLEEP(1);
+               if (cnt >= (bus->dhd->conf->txctl_tmo_fix))
+                       DHD_ERROR(("%s: No bus credit bus->tx_max %d, bus->tx_seq %d, last retry cnt %d\n",
+                               __FUNCTION__, bus->tx_max, bus->tx_seq, cnt));
+               goto retry;
+       }
 
        BUS_WAKE(bus);
 
@@ -6736,7 +6748,7 @@ clkwait:
        }
        /* Resched the DPC if ctrl cmd is pending on bus credit */
        if (bus->ctrl_frame_stat) {
-               if (bus->dhd->conf->txctl_tmo_fix) {
+               if (bus->dhd->conf->txctl_tmo_fix > 0) {
                        set_current_state(TASK_INTERRUPTIBLE);
                        if (!kthread_should_stop())
                                schedule_timeout(1);
@@ -8448,8 +8460,8 @@ dhdsdio_disconnect(void *ptr)
 
        if (bus) {
                ASSERT(bus->dhd);
-               /* Advertise bus cleanup during rmmod */
-               dhdsdio_advertise_bus_cleanup(bus->dhd);
+               /* Advertise bus remove during rmmod */
+               dhdsdio_advertise_bus_remove(bus->dhd);
                dhdsdio_release(bus, bus->dhd->osh);
        }
 
@@ -9233,6 +9245,27 @@ dhdsdio_advertise_bus_cleanup(dhd_pub_t   *dhdp)
        return;
 }
 
+static void
+dhdsdio_advertise_bus_remove(dhd_pub_t  *dhdp)
+{
+       unsigned long flags;
+       int timeleft;
+
+       DHD_LINUX_GENERAL_LOCK(dhdp, flags);
+       dhdp->busstate = DHD_BUS_REMOVE;
+       DHD_LINUX_GENERAL_UNLOCK(dhdp, flags);
+
+       timeleft = dhd_os_busbusy_wait_negation(dhdp, &dhdp->dhd_bus_busy_state);
+       if ((timeleft == 0) || (timeleft == 1)) {
+               DHD_ERROR(("%s : Timeout due to dhd_bus_busy_state=0x%x\n",
+                               __FUNCTION__, dhdp->dhd_bus_busy_state));
+               ASSERT(0);
+       }
+
+       return;
+}
+
+
 int
 dhd_bus_devreset(dhd_pub_t *dhdp, uint8 flag)
 {
index 448c30c368a198bc1ec02bd01af2365fb5dbeda2..50573e406de1797fc2ad75b6cba56d103724bcd6 100644 (file)
 #include <linux/delay.h>\r
 #include <linux/err.h>\r
 #include <linux/skbuff.h>\r
+#include <linux/wlan_plat.h>\r
 #include <linux/amlogic/dhd_buf.h>\r
 \r
+#define        DHD_STATIC_VERSION_STR          "1.579.77.41.1"\r
+\r
+#define BCMDHD_SDIO\r
+#define BCMDHD_PCIE\r
+\r
 enum dhd_prealloc_index {\r
        DHD_PREALLOC_PROT = 0,\r
-       DHD_PREALLOC_RXBUF,\r
-       DHD_PREALLOC_DATABUF,\r
-       DHD_PREALLOC_OSL_BUF,\r
-       DHD_PREALLOC_SKB_BUF,\r
+#if defined(BCMDHD_SDIO)\r
+       DHD_PREALLOC_RXBUF = 1,\r
+       DHD_PREALLOC_DATABUF = 2,\r
+#endif\r
+       DHD_PREALLOC_OSL_BUF = 3,\r
+       DHD_PREALLOC_SKB_BUF = 4,\r
        DHD_PREALLOC_WIPHY_ESCAN0 = 5,\r
        DHD_PREALLOC_WIPHY_ESCAN1 = 6,\r
        DHD_PREALLOC_DHD_INFO = 7,\r
        DHD_PREALLOC_DHD_WLFC_INFO = 8,\r
+#ifdef BCMDHD_PCIE\r
        DHD_PREALLOC_IF_FLOW_LKUP = 9,\r
+#endif\r
        DHD_PREALLOC_MEMDUMP_BUF = 10,\r
        DHD_PREALLOC_MEMDUMP_RAM = 11,\r
        DHD_PREALLOC_DHD_WLFC_HANGER = 12,\r
+       DHD_PREALLOC_PKTID_MAP = 13,\r
+       DHD_PREALLOC_PKTID_MAP_IOCTL = 14,\r
+       DHD_PREALLOC_DHD_LOG_DUMP_BUF = 15,\r
+       DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX = 16,\r
+       DHD_PREALLOC_DHD_PKTLOG_DUMP_BUF = 17,\r
+       DHD_PREALLOC_STAT_REPORT_BUF = 18,\r
+       DHD_PREALLOC_WL_ESCAN_INFO = 19,\r
+       DHD_PREALLOC_FW_VERBOSE_RING = 20,\r
+       DHD_PREALLOC_FW_EVENT_RING = 21,\r
+       DHD_PREALLOC_DHD_EVENT_RING = 22,\r
+       DHD_PREALLOC_NAN_EVENT_RING = 23,\r
        DHD_PREALLOC_MAX\r
 };\r
 \r
 #define STATIC_BUF_MAX_NUM     20\r
 #define STATIC_BUF_SIZE        (PAGE_SIZE*2)\r
 \r
-#define DHD_PREALLOC_PROT_SIZE         (16 * 1024)\r
-#define DHD_PREALLOC_RXBUF_SIZE        (24 * 1024)\r
-#define DHD_PREALLOC_DATABUF_SIZE      (64 * 1024)\r
-#define DHD_PREALLOC_OSL_BUF_SIZE      (STATIC_BUF_MAX_NUM * STATIC_BUF_SIZE)\r
+#define DHD_PREALLOC_PROT_SIZE (16 * 1024)\r
+#define DHD_PREALLOC_RXBUF_SIZE        (24 * 1024)\r
+#define DHD_PREALLOC_DATABUF_SIZE      (64 * 1024)\r
+#define DHD_PREALLOC_OSL_BUF_SIZE      (STATIC_BUF_MAX_NUM * STATIC_BUF_SIZE)\r
 #define DHD_PREALLOC_WIPHY_ESCAN0_SIZE (64 * 1024)\r
-#define DHD_PREALLOC_DHD_INFO_SIZE             (24 * 1024)\r
-#define DHD_PREALLOC_DHD_WLFC_HANGER_SIZE      (64 * 1024)\r
+#define DHD_PREALLOC_DHD_INFO_SIZE     (30 * 1024)\r
+#define DHD_PREALLOC_MEMDUMP_RAM_SIZE  (770 * 1024)\r
+#define DHD_PREALLOC_DHD_WLFC_HANGER_SIZE      (73 * 1024)\r
+#define DHD_PREALLOC_WL_ESCAN_INFO_SIZE        (66 * 1024)\r
 #ifdef CONFIG_64BIT\r
 #define DHD_PREALLOC_IF_FLOW_LKUP_SIZE (20 * 1024 * 2)\r
 #else\r
 #define DHD_PREALLOC_IF_FLOW_LKUP_SIZE (20 * 1024)\r
 #endif\r
+#define FW_VERBOSE_RING_SIZE           (64 * 1024)\r
+#define FW_EVENT_RING_SIZE             (64 * 1024)\r
+#define DHD_EVENT_RING_SIZE            (64 * 1024)\r
+#define NAN_EVENT_RING_SIZE            (64 * 1024)\r
 \r
 #if defined(CONFIG_64BIT)\r
-#define WLAN_DHD_INFO_BUF_SIZE         (24 * 1024)\r
-#define WLAN_DHD_WLFC_BUF_SIZE         (64 * 1024)\r
+#define WLAN_DHD_INFO_BUF_SIZE (24 * 1024)\r
+#define WLAN_DHD_WLFC_BUF_SIZE (64 * 1024)\r
 #define WLAN_DHD_IF_FLOW_LKUP_SIZE     (64 * 1024)\r
 #else\r
-#define WLAN_DHD_INFO_BUF_SIZE         (16 * 1024)\r
-#define WLAN_DHD_WLFC_BUF_SIZE         (24 * 1024)\r
+#define WLAN_DHD_INFO_BUF_SIZE (16 * 1024)\r
+#define WLAN_DHD_WLFC_BUF_SIZE (24 * 1024)\r
 #define WLAN_DHD_IF_FLOW_LKUP_SIZE     (20 * 1024)\r
 #endif /* CONFIG_64BIT */\r
-#define WLAN_DHD_MEMDUMP_SIZE          (800 * 1024)\r
+#define WLAN_DHD_MEMDUMP_SIZE  (800 * 1024)\r
 \r
-#ifdef CONFIG_BCMDHD_PCIE\r
 #define DHD_SKB_1PAGE_BUFSIZE  (PAGE_SIZE*1)\r
 #define DHD_SKB_2PAGE_BUFSIZE  (PAGE_SIZE*2)\r
 #define DHD_SKB_4PAGE_BUFSIZE  (PAGE_SIZE*4)\r
 \r
-#define DHD_SKB_1PAGE_BUF_NUM  0\r
-#define DHD_SKB_2PAGE_BUF_NUM  64\r
-#define DHD_SKB_4PAGE_BUF_NUM  0\r
-#else\r
-#define DHD_SKB_HDRSIZE                336\r
-#define DHD_SKB_1PAGE_BUFSIZE  ((PAGE_SIZE*1)-DHD_SKB_HDRSIZE)\r
-#define DHD_SKB_2PAGE_BUFSIZE  ((PAGE_SIZE*2)-DHD_SKB_HDRSIZE)\r
-#define DHD_SKB_4PAGE_BUFSIZE  ((PAGE_SIZE*4)-DHD_SKB_HDRSIZE)\r
-\r
 #define DHD_SKB_1PAGE_BUF_NUM  8\r
+#ifdef BCMDHD_PCIE\r
+#define DHD_SKB_2PAGE_BUF_NUM  64\r
+#elif defined(BCMDHD_SDIO)\r
 #define DHD_SKB_2PAGE_BUF_NUM  8\r
+#endif\r
 #define DHD_SKB_4PAGE_BUF_NUM  1\r
-#endif /* CONFIG_BCMDHD_PCIE */\r
 \r
 /* The number is defined in linux_osl.c\r
  * WLAN_SKB_1_2PAGE_BUF_NUM => STATIC_PKT_1_2PAGE_NUM\r
@@ -97,30 +117,38 @@ enum dhd_prealloc_index {
                (DHD_SKB_2PAGE_BUF_NUM))\r
 #define WLAN_SKB_BUF_NUM ((WLAN_SKB_1_2PAGE_BUF_NUM) + (DHD_SKB_4PAGE_BUF_NUM))\r
 \r
-void *wlan_static_prot = NULL;\r
-void *wlan_static_rxbuf = NULL;\r
-void *wlan_static_databuf = NULL;\r
-void *wlan_static_osl_buf = NULL;\r
-void *wlan_static_scan_buf0 = NULL;\r
-void *wlan_static_scan_buf1 = NULL;\r
-void *wlan_static_dhd_info_buf = NULL;\r
-void *wlan_static_dhd_wlfc_info_buf = NULL;\r
-void *wlan_static_if_flow_lkup = NULL;\r
-void *wlan_static_dhd_wlfc_hanger_buf = NULL;\r
+void *wlan_static_prot;\r
+void *wlan_static_rxbuf;\r
+void *wlan_static_databuf;\r
+void *wlan_static_osl_buf;\r
+void *wlan_static_scan_buf0;\r
+void *wlan_static_scan_buf1;\r
+void *wlan_static_dhd_info_buf;\r
+void *wlan_static_dhd_wlfc_info_buf;\r
+void *wlan_static_if_flow_lkup;\r
+void *wlan_static_dhd_memdump_ram_buf;\r
+void *wlan_static_dhd_wlfc_hanger_buf;\r
+void *wlan_static_wl_escan_info_buf;\r
+void *wlan_static_fw_verbose_ring_buf;\r
+void *wlan_static_fw_event_ring_buf;\r
+void *wlan_static_dhd_event_ring_buf;\r
+void *wlan_static_nan_event_ring_buf;\r
 \r
 static struct sk_buff *wlan_static_skb[WLAN_SKB_BUF_NUM];\r
 \r
-void *dhd_wlan_mem_prealloc(int section, unsigned long size)\r
+void *bcmdhd_mem_prealloc(int section, unsigned long size)\r
 {\r
-       printk("%s: sectoin %d, %ld\n", __FUNCTION__, section, size);\r
+       pr_err("%s: sectoin %d, %ld\n", __func__, section, size);\r
        if (section == DHD_PREALLOC_PROT)\r
                return wlan_static_prot;\r
 \r
+#if defined(BCMDHD_SDIO)\r
        if (section == DHD_PREALLOC_RXBUF)\r
                return wlan_static_rxbuf;\r
 \r
        if (section == DHD_PREALLOC_DATABUF)\r
                return wlan_static_databuf;\r
+#endif /* BCMDHD_SDIO */\r
 \r
        if (section == DHD_PREALLOC_SKB_BUF)\r
                return wlan_static_skb;\r
@@ -133,7 +161,7 @@ void *dhd_wlan_mem_prealloc(int section, unsigned long size)
 \r
        if (section == DHD_PREALLOC_OSL_BUF) {\r
                if (size > DHD_PREALLOC_OSL_BUF_SIZE) {\r
-                       pr_err("request OSL_BUF(%lu) is bigger than static size(%ld).\n",\r
+                       pr_err("request OSL_BUF(%lu) > %ld\n",\r
                                size, DHD_PREALLOC_OSL_BUF_SIZE);\r
                        return NULL;\r
                }\r
@@ -142,7 +170,7 @@ void *dhd_wlan_mem_prealloc(int section, unsigned long size)
 \r
        if (section == DHD_PREALLOC_DHD_INFO) {\r
                if (size > DHD_PREALLOC_DHD_INFO_SIZE) {\r
-                       pr_err("request DHD_INFO size(%lu) is bigger than static size(%d).\n",\r
+                       pr_err("request DHD_INFO size(%lu) > %d\n",\r
                                size, DHD_PREALLOC_DHD_INFO_SIZE);\r
                        return NULL;\r
                }\r
@@ -150,40 +178,97 @@ void *dhd_wlan_mem_prealloc(int section, unsigned long size)
        }\r
        if (section == DHD_PREALLOC_DHD_WLFC_INFO) {\r
                if (size > WLAN_DHD_WLFC_BUF_SIZE) {\r
-                       pr_err("request DHD_WLFC_INFO size(%lu) is bigger than static size(%d).\n",\r
+                       pr_err("request DHD_WLFC_INFO size(%lu) > %d\n",\r
                                size, WLAN_DHD_WLFC_BUF_SIZE);\r
                        return NULL;\r
                }\r
                return wlan_static_dhd_wlfc_info_buf;\r
        }\r
+#ifdef BCMDHD_PCIE\r
        if (section == DHD_PREALLOC_IF_FLOW_LKUP)  {\r
                if (size > DHD_PREALLOC_IF_FLOW_LKUP_SIZE) {\r
-                       pr_err("request DHD_IF_FLOW_LKUP size(%lu) is bigger than static size(%d).\n",\r
+                       pr_err("request DHD_IF_FLOW_LKUP size(%lu) > %d\n",\r
                                size, DHD_PREALLOC_IF_FLOW_LKUP_SIZE);\r
                        return NULL;\r
                }\r
 \r
                return wlan_static_if_flow_lkup;\r
        }\r
+#endif /* BCMDHD_PCIE */\r
+       if (section == DHD_PREALLOC_MEMDUMP_RAM) {\r
+               if (size > DHD_PREALLOC_MEMDUMP_RAM_SIZE) {\r
+                       pr_err("request DHD_PREALLOC_MEMDUMP_RAM_SIZE(%lu) > %d\n",\r
+                               size, DHD_PREALLOC_MEMDUMP_RAM_SIZE);\r
+                       return NULL;\r
+               }\r
+\r
+               return wlan_static_dhd_memdump_ram_buf;\r
+       }\r
        if (section == DHD_PREALLOC_DHD_WLFC_HANGER) {\r
                if (size > DHD_PREALLOC_DHD_WLFC_HANGER_SIZE) {\r
-                       pr_err("request DHD_WLFC_HANGER size(%lu) is bigger than static size(%d).\n",\r
+                       pr_err("request DHD_WLFC_HANGER size(%lu) > %d\n",\r
                                size, DHD_PREALLOC_DHD_WLFC_HANGER_SIZE);\r
                        return NULL;\r
                }\r
                return wlan_static_dhd_wlfc_hanger_buf;\r
        }\r
+       if (section == DHD_PREALLOC_WL_ESCAN_INFO) {\r
+               if (size > DHD_PREALLOC_WL_ESCAN_INFO_SIZE) {\r
+                       pr_err("request DHD_PREALLOC_WL_ESCAN_INFO_SIZE(%lu) > %d\n",\r
+                               size, DHD_PREALLOC_WL_ESCAN_INFO_SIZE);\r
+                       return NULL;\r
+               }\r
+\r
+               return wlan_static_wl_escan_info_buf;\r
+       }\r
+       if (section == DHD_PREALLOC_FW_VERBOSE_RING) {\r
+               if (size > FW_VERBOSE_RING_SIZE) {\r
+                       pr_err("request DHD_PREALLOC_FW_VERBOSE_RING(%lu) > %d\n",\r
+                               size, FW_VERBOSE_RING_SIZE);\r
+                       return NULL;\r
+               }\r
+\r
+               return wlan_static_fw_verbose_ring_buf;\r
+       }\r
+       if (section == DHD_PREALLOC_FW_EVENT_RING) {\r
+               if (size > FW_EVENT_RING_SIZE) {\r
+                       pr_err("request DHD_PREALLOC_FW_EVENT_RING(%lu) > %d\n",\r
+                               size, FW_EVENT_RING_SIZE);\r
+                       return NULL;\r
+               }\r
+\r
+               return wlan_static_fw_event_ring_buf;\r
+       }\r
+       if (section == DHD_PREALLOC_DHD_EVENT_RING) {\r
+               if (size > DHD_EVENT_RING_SIZE) {\r
+                       pr_err("request DHD_PREALLOC_DHD_EVENT_RING(%lu) > %d\n",\r
+                               size, DHD_EVENT_RING_SIZE);\r
+                       return NULL;\r
+               }\r
+\r
+               return wlan_static_dhd_event_ring_buf;\r
+       }\r
+       if (section == DHD_PREALLOC_NAN_EVENT_RING) {\r
+               if (size > NAN_EVENT_RING_SIZE) {\r
+                       pr_err("request DHD_PREALLOC_NAN_EVENT_RING(%lu) > %d\n",\r
+                               size, NAN_EVENT_RING_SIZE);\r
+                       return NULL;\r
+               }\r
+\r
+               return wlan_static_nan_event_ring_buf;\r
+       }\r
        if ((section < 0) || (section > DHD_PREALLOC_MAX))\r
                pr_err("request section id(%d) is out of max index %d\n",\r
                                section, DHD_PREALLOC_MAX);\r
 \r
-       pr_err("%s: failed to alloc section %d, size=%ld\n", __FUNCTION__, section, size);\r
+       pr_err("%s: failed to alloc section %d, size=%ld\n",\r
+               __func__, section, size);\r
 \r
        return NULL;\r
 }\r
-EXPORT_SYMBOL(dhd_wlan_mem_prealloc);\r
+EXPORT_SYMBOL(bcmdhd_mem_prealloc);\r
 \r
-static int dhd_init_wlan_mem(void)\r
+int bcmdhd_init_wlan_mem(void)\r
 {\r
        int i;\r
        int j;\r
@@ -193,7 +278,8 @@ static int dhd_init_wlan_mem(void)
                if (!wlan_static_skb[i]) {\r
                        goto err_skb_alloc;\r
                }\r
-               printk("%s: sectoin %d skb[%d], size=%ld\n", __FUNCTION__, DHD_PREALLOC_SKB_BUF, i, DHD_SKB_1PAGE_BUFSIZE);\r
+               pr_err("%s: sectoin %d skb[%d], size=%ld\n", __func__,\r
+                       DHD_PREALLOC_SKB_BUF, i, DHD_SKB_1PAGE_BUFSIZE);\r
        }\r
 \r
        for (i = DHD_SKB_1PAGE_BUF_NUM; i < WLAN_SKB_1_2PAGE_BUF_NUM; i++) {\r
@@ -201,203 +287,144 @@ static int dhd_init_wlan_mem(void)
                if (!wlan_static_skb[i]) {\r
                        goto err_skb_alloc;\r
                }\r
-               printk("%s: sectoin %d skb[%d], size=%ld\n", __FUNCTION__, DHD_PREALLOC_SKB_BUF, i, DHD_SKB_2PAGE_BUFSIZE);\r
+               pr_err("%s: sectoin %d skb[%d], size=%ld\n", __func__,\r
+                       DHD_PREALLOC_SKB_BUF, i, DHD_SKB_2PAGE_BUFSIZE);\r
        }\r
 \r
-#if !defined(CONFIG_BCMDHD_PCIE)\r
+#if defined(BCMDHD_SDIO)\r
        wlan_static_skb[i] = dev_alloc_skb(DHD_SKB_4PAGE_BUFSIZE);\r
-       if (!wlan_static_skb[i]) {\r
+       if (!wlan_static_skb[i])\r
                goto err_skb_alloc;\r
-       }\r
-#endif /* !CONFIG_BCMDHD_PCIE */\r
+       pr_err("%s: sectoin %d skb[%d], size=%ld\n", __func__,\r
+               DHD_PREALLOC_SKB_BUF, i, DHD_SKB_4PAGE_BUFSIZE);\r
+#endif /* BCMDHD_SDIO */\r
 \r
        wlan_static_prot = kmalloc(DHD_PREALLOC_PROT_SIZE, GFP_KERNEL);\r
-       if (!wlan_static_prot) {\r
-               pr_err("Failed to alloc wlan_static_prot\n");\r
+       if (!wlan_static_prot)\r
                goto err_mem_alloc;\r
-       }\r
-       printk("%s: sectoin %d, size=%d\n", __FUNCTION__, DHD_PREALLOC_PROT, DHD_PREALLOC_PROT_SIZE);\r
+       pr_err("%s: sectoin %d, size=%d\n", __func__,\r
+               DHD_PREALLOC_PROT, DHD_PREALLOC_PROT_SIZE);\r
 \r
-#if defined(CONFIG_BCMDHD_SDIO)\r
+#if defined(BCMDHD_SDIO)\r
        wlan_static_rxbuf = kmalloc(DHD_PREALLOC_RXBUF_SIZE, GFP_KERNEL);\r
-       if (!wlan_static_rxbuf) {\r
-               pr_err("Failed to alloc wlan_static_rxbuf\n");\r
+       if (!wlan_static_rxbuf)\r
                goto err_mem_alloc;\r
-       }\r
-       printk("%s: sectoin %d, size=%d\n", __FUNCTION__, DHD_PREALLOC_RXBUF, DHD_PREALLOC_RXBUF_SIZE);\r
+       pr_err("%s: sectoin %d, size=%d\n", __func__,\r
+               DHD_PREALLOC_RXBUF, DHD_PREALLOC_RXBUF_SIZE);\r
 \r
        wlan_static_databuf = kmalloc(DHD_PREALLOC_DATABUF_SIZE, GFP_KERNEL);\r
-       if (!wlan_static_databuf) {\r
-               pr_err("Failed to alloc wlan_static_databuf\n");\r
+       if (!wlan_static_databuf)\r
                goto err_mem_alloc;\r
-       }\r
-       printk("%s: sectoin %d, size=%d\n", __FUNCTION__, DHD_PREALLOC_DATABUF, DHD_PREALLOC_DATABUF_SIZE);\r
-#endif\r
+       pr_err("%s: sectoin %d, size=%d\n", __func__,\r
+               DHD_PREALLOC_DATABUF, DHD_PREALLOC_DATABUF_SIZE);\r
+#endif /* BCMDHD_SDIO */\r
 \r
        wlan_static_osl_buf = kmalloc(DHD_PREALLOC_OSL_BUF_SIZE, GFP_KERNEL);\r
-       if (!wlan_static_osl_buf) {\r
-               pr_err("Failed to alloc wlan_static_osl_buf\n");\r
+       if (!wlan_static_osl_buf)\r
                goto err_mem_alloc;\r
-       }\r
-       printk("%s: sectoin %d, size=%ld\n", __FUNCTION__, DHD_PREALLOC_OSL_BUF, DHD_PREALLOC_OSL_BUF_SIZE);\r
+       pr_err("%s: sectoin %d, size=%ld\n", __func__,\r
+               DHD_PREALLOC_OSL_BUF, DHD_PREALLOC_OSL_BUF_SIZE);\r
 \r
        wlan_static_scan_buf0 = kmalloc(DHD_PREALLOC_WIPHY_ESCAN0_SIZE, GFP_KERNEL);\r
-       if (!wlan_static_scan_buf0) {\r
-               pr_err("Failed to alloc wlan_static_scan_buf0\n");\r
+       if (!wlan_static_scan_buf0)\r
                goto err_mem_alloc;\r
-       }\r
-       printk("%s: sectoin %d, size=%d\n", __FUNCTION__, DHD_PREALLOC_WIPHY_ESCAN0, DHD_PREALLOC_WIPHY_ESCAN0_SIZE);\r
+       pr_err("%s: sectoin %d, size=%d\n", __func__,\r
+               DHD_PREALLOC_WIPHY_ESCAN0, DHD_PREALLOC_WIPHY_ESCAN0_SIZE);\r
 \r
        wlan_static_dhd_info_buf = kmalloc(DHD_PREALLOC_DHD_INFO_SIZE, GFP_KERNEL);\r
-       if (!wlan_static_dhd_info_buf) {\r
-               pr_err("Failed to alloc wlan_static_dhd_info_buf\n");\r
+       if (!wlan_static_dhd_info_buf)\r
                goto err_mem_alloc;\r
-       }\r
-       printk("%s: sectoin %d, size=%d\n", __FUNCTION__, DHD_PREALLOC_DHD_INFO, DHD_PREALLOC_DHD_INFO_SIZE);\r
+       pr_err("%s: sectoin %d, size=%d\n", __func__,\r
+               DHD_PREALLOC_DHD_INFO, DHD_PREALLOC_DHD_INFO_SIZE);\r
 \r
        wlan_static_dhd_wlfc_info_buf = kmalloc(WLAN_DHD_WLFC_BUF_SIZE, GFP_KERNEL);\r
-       if (!wlan_static_dhd_wlfc_info_buf) {\r
-               pr_err("Failed to alloc wlan_static_dhd_wlfc_info_buf\n");\r
-               goto err_mem_alloc;\r
-       }\r
-       printk("%s: sectoin %d, size=%d\n", __FUNCTION__, DHD_PREALLOC_DHD_WLFC_INFO, WLAN_DHD_WLFC_BUF_SIZE);\r
-\r
-       wlan_static_dhd_wlfc_hanger_buf = kmalloc(DHD_PREALLOC_DHD_WLFC_HANGER_SIZE, GFP_KERNEL);\r
-       if (!wlan_static_dhd_wlfc_hanger_buf) {\r
-               pr_err("Failed to alloc wlan_static_dhd_wlfc_hanger_buf\n");\r
+       if (!wlan_static_dhd_wlfc_info_buf)\r
                goto err_mem_alloc;\r
-       }\r
-       printk("%s: sectoin %d, size=%d\n", __FUNCTION__, DHD_PREALLOC_DHD_WLFC_HANGER, DHD_PREALLOC_DHD_WLFC_HANGER_SIZE);\r
+       pr_err("%s: sectoin %d, size=%d\n", __func__,\r
+               DHD_PREALLOC_DHD_WLFC_INFO, WLAN_DHD_WLFC_BUF_SIZE);\r
 \r
-#ifdef CONFIG_BCMDHD_PCIE\r
+#ifdef BCMDHD_PCIE\r
        wlan_static_if_flow_lkup = kmalloc(DHD_PREALLOC_IF_FLOW_LKUP_SIZE, GFP_KERNEL);\r
-       if (!wlan_static_if_flow_lkup) {\r
-               pr_err("Failed to alloc wlan_static_if_flow_lkup\n");\r
+       if (!wlan_static_if_flow_lkup)\r
                goto err_mem_alloc;\r
-       }\r
-#endif /* CONFIG_BCMDHD_PCIE */\r
-\r
-       return 0;\r
-\r
-err_mem_alloc:\r
+#endif /* BCMDHD_PCIE */\r
 \r
-       if (wlan_static_prot)\r
-               kfree(wlan_static_prot);\r
+       wlan_static_dhd_memdump_ram_buf = kmalloc(DHD_PREALLOC_MEMDUMP_RAM_SIZE, GFP_KERNEL);\r
+       if (!wlan_static_dhd_memdump_ram_buf) \r
+               goto err_mem_alloc;\r
+       pr_err("%s: sectoin %d, size=%d\n", __func__,\r
+               DHD_PREALLOC_MEMDUMP_RAM, DHD_PREALLOC_MEMDUMP_RAM_SIZE);\r
 \r
-#if defined(CONFIG_BCMDHD_SDIO)\r
-       if (wlan_static_rxbuf)\r
-               kfree(wlan_static_rxbuf);\r
+       wlan_static_dhd_wlfc_hanger_buf = kmalloc(DHD_PREALLOC_DHD_WLFC_HANGER_SIZE, GFP_KERNEL);\r
+       if (!wlan_static_dhd_wlfc_hanger_buf)\r
+               goto err_mem_alloc;\r
+       pr_err("%s: sectoin %d, size=%d\n", __func__,\r
+               DHD_PREALLOC_DHD_WLFC_HANGER, DHD_PREALLOC_DHD_WLFC_HANGER_SIZE);\r
 \r
-       if (wlan_static_databuf)\r
-               kfree(wlan_static_databuf);\r
-#endif\r
+       wlan_static_wl_escan_info_buf = kmalloc(DHD_PREALLOC_WL_ESCAN_INFO_SIZE, GFP_KERNEL);\r
+       if (!wlan_static_wl_escan_info_buf)\r
+               goto err_mem_alloc;\r
+       pr_err("%s: sectoin %d, size=%d\n", __func__,\r
+               DHD_PREALLOC_WL_ESCAN_INFO, DHD_PREALLOC_WL_ESCAN_INFO_SIZE);\r
 \r
-       if (wlan_static_dhd_info_buf)\r
-               kfree(wlan_static_dhd_info_buf);\r
+       wlan_static_fw_verbose_ring_buf = kmalloc(\r
+                                               DHD_PREALLOC_WIPHY_ESCAN0_SIZE,\r
+                                               GFP_KERNEL);\r
+       if (!wlan_static_fw_verbose_ring_buf)\r
+               goto err_mem_alloc;\r
+       pr_err("%s: sectoin %d, size=%d\n", __func__,\r
+               DHD_PREALLOC_FW_VERBOSE_RING, DHD_PREALLOC_WL_ESCAN_INFO_SIZE);\r
 \r
-       if (wlan_static_dhd_wlfc_info_buf)\r
-               kfree(wlan_static_dhd_wlfc_info_buf);\r
+       wlan_static_fw_event_ring_buf = kmalloc(DHD_PREALLOC_WIPHY_ESCAN0_SIZE, GFP_KERNEL);\r
+       if (!wlan_static_fw_event_ring_buf)\r
+               goto err_mem_alloc;\r
+       pr_err("%s: sectoin %d, size=%d\n", __func__,\r
+               DHD_PREALLOC_FW_EVENT_RING, DHD_PREALLOC_WL_ESCAN_INFO_SIZE);\r
 \r
-       if (wlan_static_dhd_wlfc_hanger_buf)\r
-               kfree(wlan_static_dhd_wlfc_hanger_buf);\r
+       wlan_static_dhd_event_ring_buf = kmalloc(DHD_PREALLOC_WIPHY_ESCAN0_SIZE, GFP_KERNEL);\r
+       if (!wlan_static_dhd_event_ring_buf)\r
+               goto err_mem_alloc;\r
+       pr_err("%s: sectoin %d, size=%d\n", __func__,\r
+               DHD_PREALLOC_DHD_EVENT_RING, DHD_PREALLOC_WL_ESCAN_INFO_SIZE);\r
 \r
-       if (wlan_static_scan_buf1)\r
-               kfree(wlan_static_scan_buf1);\r
+       wlan_static_nan_event_ring_buf = kmalloc(DHD_PREALLOC_WIPHY_ESCAN0_SIZE, GFP_KERNEL);\r
+       if (!wlan_static_nan_event_ring_buf)\r
+               goto err_mem_alloc;\r
+       pr_err("%s: sectoin %d, size=%d\n", __func__,\r
+               DHD_PREALLOC_NAN_EVENT_RING, DHD_PREALLOC_WL_ESCAN_INFO_SIZE);\r
 \r
-       if (wlan_static_scan_buf0)\r
-               kfree(wlan_static_scan_buf0);\r
+       return 0;\r
 \r
-       if (wlan_static_osl_buf)\r
-               kfree(wlan_static_osl_buf);\r
+err_mem_alloc:\r
 \r
-#ifdef CONFIG_BCMDHD_PCIE\r
-       if (wlan_static_if_flow_lkup)\r
-               kfree(wlan_static_if_flow_lkup);\r
-#endif\r
-       pr_err("Failed to mem_alloc for WLAN\n");\r
+       kfree(wlan_static_prot);\r
+       kfree(wlan_static_rxbuf);\r
+       kfree(wlan_static_databuf);\r
+       kfree(wlan_static_osl_buf);\r
+       kfree(wlan_static_scan_buf0);\r
+       kfree(wlan_static_scan_buf1);\r
+       kfree(wlan_static_dhd_info_buf);\r
+       kfree(wlan_static_dhd_wlfc_info_buf);\r
+       kfree(wlan_static_if_flow_lkup);\r
+       kfree(wlan_static_dhd_memdump_ram_buf);\r
+       kfree(wlan_static_dhd_wlfc_hanger_buf);\r
+       kfree(wlan_static_wl_escan_info_buf);\r
+       kfree(wlan_static_fw_verbose_ring_buf);\r
+       kfree(wlan_static_fw_event_ring_buf);\r
+       kfree(wlan_static_dhd_event_ring_buf);\r
+       kfree(wlan_static_nan_event_ring_buf);\r
+       pr_err("%s: Failed to mem_alloc for WLAN\n", __func__);\r
 \r
        i = WLAN_SKB_BUF_NUM;\r
 \r
 err_skb_alloc:\r
-       pr_err("Failed to skb_alloc for WLAN\n");\r
-       for (j = 0; j < i; j++) {\r
+       pr_err("%s: Failed to skb_alloc for WLAN\n", __func__);\r
+       for (j = 0; j < i; j++)\r
                dev_kfree_skb(wlan_static_skb[j]);\r
-       }\r
 \r
        return -ENOMEM;\r
 }\r
-\r
-int\r
-bcmdhd_init_wlan_mem(void)\r
-{\r
-       printk(KERN_ERR "%s()\n", __FUNCTION__);\r
-\r
-       dhd_init_wlan_mem();\r
-\r
-       return 0;\r
-}\r
-\r
-static void\r
-dhd_static_buf_exit(void)\r
-{\r
-       int i;\r
-\r
-       printk(KERN_ERR "%s()\n", __FUNCTION__);\r
-\r
-       for (i = 0; i < DHD_SKB_1PAGE_BUF_NUM; i++) {\r
-               if (wlan_static_skb[i])\r
-                       dev_kfree_skb(wlan_static_skb[i]);\r
-       }\r
-\r
-       for (i = DHD_SKB_1PAGE_BUF_NUM; i < WLAN_SKB_1_2PAGE_BUF_NUM; i++) {\r
-               if (wlan_static_skb[i])\r
-                       dev_kfree_skb(wlan_static_skb[i]);\r
-       }\r
-\r
-#if !defined(CONFIG_BCMDHD_PCIE)\r
-       if (wlan_static_skb[i])\r
-               dev_kfree_skb(wlan_static_skb[i]);\r
-#endif /* !CONFIG_BCMDHD_PCIE */\r
-\r
-       if (wlan_static_prot)\r
-               kfree(wlan_static_prot);\r
-\r
-#if defined(CONFIG_BCMDHD_SDIO)\r
-       if (wlan_static_rxbuf)\r
-               kfree(wlan_static_rxbuf);\r
-\r
-       if (wlan_static_databuf)\r
-               kfree(wlan_static_databuf);\r
-#endif\r
-\r
-       if (wlan_static_osl_buf)\r
-               kfree(wlan_static_osl_buf);\r
-\r
-       if (wlan_static_scan_buf0)\r
-               kfree(wlan_static_scan_buf0);\r
-\r
-       if (wlan_static_dhd_info_buf)\r
-               kfree(wlan_static_dhd_info_buf);\r
-\r
-       if (wlan_static_dhd_wlfc_info_buf)\r
-               kfree(wlan_static_dhd_wlfc_info_buf);\r
-\r
-       if (wlan_static_dhd_wlfc_hanger_buf)\r
-               kfree(wlan_static_dhd_wlfc_hanger_buf);\r
-\r
-       if (wlan_static_scan_buf1)\r
-               kfree(wlan_static_scan_buf1);\r
-\r
-#ifdef CONFIG_BCMDHD_PCIE\r
-       if (wlan_static_if_flow_lkup)\r
-               kfree(wlan_static_if_flow_lkup);\r
-#endif\r
-       return;\r
-}\r
-\r
-\r
 EXPORT_SYMBOL(bcmdhd_init_wlan_mem);\r
-#endif /* CONFIG_BROADCOM_WIFI_RESERVED_MEM */\r
 MODULE_LICENSE("GPL");\r
 MODULE_AUTHOR("AMLOGIC");\r
 MODULE_DESCRIPTION("wifi device tree driver");\r
index 56a398dae1d33083330a8f2f964344f52df68517..4cf4c70348c8d45e398a89d1d1ac9021b8ed1182 100644 (file)
@@ -46,6 +46,6 @@
 #define EPI_VERSION_DEV                1.579.77.41
 
 /* Driver Version String, ASCII, 32 chars max */
-#define        EPI_VERSION_STR         "1.579.77.41.1 (r)"
+#define        EPI_VERSION_STR         "1.579.77.41.2 (r)"
 
 #endif /* _epivers_h_ */
index d3b11615c1f1607f9b37e14f93622806cad2a657..082b301522663a4c819d1414f64339e77b95c87a 100644 (file)
@@ -67,9 +67,7 @@ typedef void  (*osl_wreg_fn_t)(void *ctx, volatile void *reg, unsigned int val,
 #ifndef OR_REG
 #define OR_REG(osh, r, v)              W_REG(osh, (r), R_REG(osh, r) | (v))
 #endif   /* !OR_REG */
-#ifdef CONFIG_DHD_USE_STATIC_BUF
-void* bcm_wlan_prealloc(int section, unsigned long size);
-#endif
+
 #if !defined(OSL_SYSUPTIME)
 #define OSL_SYSUPTIME() (0)
 #define OSL_SYSUPTIME_SUPPORT FALSE
index 1e6a3a280e0819a86320571366b11cfbfc50ae20..82c4b4feb04d2834ed8dd035da507f68b69b6b1d 100644 (file)
@@ -11554,6 +11554,13 @@ typedef struct wl_interface_create {
        struct  ether_addr   mac_addr;  /* Optional Mac address */
 } wl_interface_create_t;
 
+typedef struct wl_interface_create_v0 {
+       uint16  ver;                    /* version of this struct */
+       struct ether_addr    mac_addr;  /* MAC address of the interface */
+       char    ifname[BCM_MSG_IFNAME_MAX]; /* name of interface */
+       uint8   bsscfgidx;              /* source bsscfg index */
+} wl_interface_info_t;
+
 typedef struct wl_interface_create_v1 {
        uint16  ver;                    /**< version of this struct */
        uint8   pad1[2];                /**< Padding bytes */
index 25b7563e5e31f5c61411636b3c3a66902b81d1f3..42afe36f883462795a8ccfda96e3d0b9433551fd 100644 (file)
@@ -1004,7 +1004,7 @@ wl_cfg80211_get_sta_info(struct net_device *dev, char* command, int total_len)
        uint32 rxrtry = 0;
        uint32 rxmulti = 0;
 
-       WL_DBG(("%s\n", command));
+       ANDROID_TRACE(("%s\n", command));
        str = bcmstrtok(&pcmd, " ", NULL);
        if (str) {
                str = bcmstrtok(&pcmd, " ", NULL);
@@ -1063,7 +1063,7 @@ wl_cfg80211_get_sta_info(struct net_device *dev, char* command, int total_len)
                "%s %s Rx_Retry_Pkts=%d Rx_BcMc_Pkts=%d CAP=%04x\n",
                CMD_GET_STA_INFO, str, rxrtry, rxmulti, cap);
 
-       WL_DBG(("%s", command));
+       ANDROID_TRACE(("%s", command));
 
 error:
        return bytes_written;
@@ -2496,6 +2496,7 @@ wl_android_set_auto_channel(struct net_device *dev, const char* cmd_str,
        u8 *reqbuf = NULL;
        uint32 band = WLC_BAND_2G;
        uint32 buf_size;
+       char *pos = command;
 
        if (cmd_str) {
                ANDROID_INFO(("Command: %s len:%d \n", cmd_str, (int)strlen(cmd_str)));
@@ -2623,7 +2624,7 @@ wl_android_set_auto_channel(struct net_device *dev, const char* cmd_str,
                        apcs_band = (band == WLC_BAND_AUTO) ? WLC_BAND_2G : band;
                        chosen_band = (channel <= CH_MAX_2G_CHANNEL) ? WLC_BAND_2G : WLC_BAND_5G;
                        if (apcs_band == chosen_band) {
-                               ANDROID_ERROR(("selected channel = %d\n", channel));
+                               printf("%s: selected channel = %d\n", __FUNCTION__, channel);
                                break;
                        }
                }
@@ -2654,7 +2655,11 @@ done2:
        }
 
        if (channel) {
-               snprintf(command, 4, "%d", channel);
+               if (channel < 15)
+                       pos += snprintf(pos, total_len, "2g=");
+               else
+                       pos += snprintf(pos, total_len, "5g=");
+               pos += snprintf(pos, total_len, "%d", channel);
                ANDROID_INFO(("command result is %s \n", command));
                return strlen(command);
        } else {
@@ -2767,7 +2772,7 @@ static int wl_android_set_rmc_event(struct net_device *dev, char *command, int t
        /* set pid, and if the event was happened, let's send a notification through netlink */
        wl_cfg80211_set_rmc_pid(dev, pid);
 
-       WL_DBG(("RMC pid=%d\n", pid));
+       ANDROID_TRACE(("RMC pid=%d\n", pid));
 
        return err;
 }
@@ -3474,7 +3479,7 @@ wl_netlink_send_msg(int pid, int type, int seq, const void *data, size_t size)
 
        /* netlink_unicast() takes ownership of the skb and frees it itself. */
        ret = netlink_unicast(nl_sk, skb, pid, 0);
-       WL_DBG(("netlink_unicast() pid=%d, ret=%d\n", pid, ret));
+       ANDROID_TRACE(("netlink_unicast() pid=%d, ret=%d\n", pid, ret));
 
 nlmsg_failure:
        return ret;
@@ -3631,7 +3636,7 @@ static int wl_android_get_link_status(struct net_device *dev, char *command,
        }
 
        if (i == ETHER_ADDR_LEN) {
-               WL_DBG(("No BSSID\n"));
+               ANDROID_TRACE(("No BSSID\n"));
                return -1;
        }
 
@@ -3721,7 +3726,7 @@ static int wl_android_get_link_status(struct net_device *dev, char *command,
                }
        }
 
-       WL_DBG(("%s:result=%d, stf=%d, single_stream=%d, mcs map=%d\n",
+       ANDROID_TRACE(("%s:result=%d, stf=%d, single_stream=%d, mcs map=%d\n",
                __FUNCTION__, result, stf, single_stream, nss));
 
        bytes_written = sprintf(command, "%s %d", CMD_GET_LINK_STATUS, result);
@@ -3786,7 +3791,7 @@ wl_android_murx_bfe_cap(struct net_device *dev, int val)
                sizeof(wl_reassoc_params_t))) < 0) {
                ANDROID_ERROR(("reassoc failed err:%d \n", err));
        } else {
-               WL_DBG(("reassoc issued successfully\n"));
+               ANDROID_TRACE(("reassoc issued successfully\n"));
        }
 
        return err;
@@ -3823,7 +3828,7 @@ wl_android_set_ap_beaconrate(struct net_device *dev, char *command)
                return -EINVAL;
        ifname = token;
 
-       WL_DBG(("rate %d, ifacename %s\n", rate, ifname));
+       ANDROID_TRACE(("rate %d, ifacename %s\n", rate, ifname));
 
        err = wl_set_ap_beacon_rate(dev, rate, ifname);
        if (unlikely(err)) {
@@ -3852,7 +3857,7 @@ int wl_android_get_ap_basicrate(struct net_device *dev, char *command, int total
                return -EINVAL;
        ifname = token;
 
-       WL_DBG(("ifacename %s\n", ifname));
+       ANDROID_TRACE(("ifacename %s\n", ifname));
 
        bytes_written = wl_get_ap_basic_rate(dev, command, ifname, total_len);
        if (bytes_written < 1) {
@@ -3886,7 +3891,7 @@ wl_android_get_ap_rps(struct net_device *dev, char *command, int total_len)
                return -EINVAL;
        ifname = token;
 
-       WL_DBG(("ifacename %s\n", ifname));
+       ANDROID_TRACE(("ifacename %s\n", ifname));
 
        bytes_written = wl_get_ap_rps(dev, command, ifname, total_len);
        if (bytes_written < 1) {
@@ -3926,7 +3931,7 @@ wl_android_set_ap_rps(struct net_device *dev, char *command, int total_len)
                return -EINVAL;
        ifname = token;
 
-       WL_DBG(("enable %d, ifacename %s\n", enable, ifname));
+       ANDROID_TRACE(("enable %d, ifacename %s\n", enable, ifname));
 
        err = wl_set_ap_rps(dev, enable? TRUE: FALSE, ifname);
        if (unlikely(err)) {
@@ -3983,7 +3988,7 @@ wl_android_set_ap_rps_params(struct net_device *dev, char *command, int total_le
                return -EINVAL;
        ifname = token;
 
-       WL_DBG(("pps %d, level %d, quiettime %d, sta_assoc_check %d, "
+       ANDROID_TRACE(("pps %d, level %d, quiettime %d, sta_assoc_check %d, "
                "ifacename %s\n", rps.pps, rps.level, rps.quiet_time,
                rps.sta_assoc_check, ifname));
 
@@ -4053,17 +4058,17 @@ wl_android_get_rssi_per_ant(struct net_device *dev, char *command, int total_len
        }
 
        /* Parse the results */
-       WL_DBG(("ifname %s, version %d, count %d, mimo rssi %d\n",
+       ANDROID_TRACE(("ifname %s, version %d, count %d, mimo rssi %d\n",
                ifname, rssi_ant_mimo.version, rssi_ant_mimo.count, mimo_rssi));
        if (mimo_rssi) {
-               WL_DBG(("MIMO RSSI: %d\n", rssi_ant_mimo.rssi_sum));
+               ANDROID_TRACE(("MIMO RSSI: %d\n", rssi_ant_mimo.rssi_sum));
                bytes_written = snprintf(command, total_len, "%s MIMO %d",
                        CMD_GET_RSSI_PER_ANT, rssi_ant_mimo.rssi_sum);
        } else {
                int cnt;
                bytes_written = snprintf(command, total_len, "%s PER_ANT ", CMD_GET_RSSI_PER_ANT);
                for (cnt = 0; cnt < rssi_ant_mimo.count; cnt++) {
-                       WL_DBG(("RSSI[%d]: %d\n", cnt, rssi_ant_mimo.rssi_ant[cnt]));
+                       ANDROID_TRACE(("RSSI[%d]: %d\n", cnt, rssi_ant_mimo.rssi_ant[cnt]));
                        bytes_written = snprintf(command, total_len, "%d ",
                                rssi_ant_mimo.rssi_ant[cnt]);
                }
@@ -4112,7 +4117,7 @@ wl_android_set_rssi_logging(struct net_device *dev, char *command, int total_len
        }
        set_param.time_threshold = bcm_atoi(token);
 
-       WL_DBG(("enable %d, RSSI threshold %d, Time threshold %d\n", set_param.enable,
+       ANDROID_TRACE(("enable %d, RSSI threshold %d, Time threshold %d\n", set_param.enable,
                set_param.rssi_threshold, set_param.time_threshold));
 
        err = wl_set_rssi_logging(dev, (void *)&set_param);
@@ -4138,29 +4143,29 @@ wl_android_get_rssi_logging(struct net_device *dev, char *command, int total_len
                return BCME_ERROR;
        }
 
-       WL_DBG(("report_count %d, enable %d, rssi_threshold %d, time_threshold %d\n",
+       ANDROID_TRACE(("report_count %d, enable %d, rssi_threshold %d, time_threshold %d\n",
                get_param.report_count, get_param.enable, get_param.rssi_threshold,
                get_param.time_threshold));
 
        /* Parse the parameter */
        if (!get_param.enable) {
-               WL_DBG(("RSSI LOGGING: Feature is disables\n"));
+               ANDROID_TRACE(("RSSI LOGGING: Feature is disables\n"));
                bytes_written = snprintf(command, total_len,
                        "%s FEATURE DISABLED\n", CMD_GET_RSSI_LOGGING);
        } else if (get_param.enable &
                (RSSILOG_FLAG_FEATURE_SW | RSSILOG_FLAG_REPORT_READY)) {
                if (!get_param.report_count) {
-                       WL_DBG(("[PASS] RSSI difference across antennas is within"
+                       ANDROID_TRACE(("[PASS] RSSI difference across antennas is within"
                                " threshold limits\n"));
                        bytes_written = snprintf(command, total_len, "%s PASS\n",
                                CMD_GET_RSSI_LOGGING);
                } else {
-                       WL_DBG(("[FAIL] RSSI difference across antennas found "
+                       ANDROID_TRACE(("[FAIL] RSSI difference across antennas found "
                                "to be greater than %3d dB\n", get_param.rssi_threshold));
-                       WL_DBG(("[FAIL] RSSI difference check have failed for "
+                       ANDROID_TRACE(("[FAIL] RSSI difference check have failed for "
                                "%d out of %d times\n", get_param.report_count,
                                get_param.time_threshold));
-                       WL_DBG(("[FAIL] RSSI difference is being monitored once "
+                       ANDROID_TRACE(("[FAIL] RSSI difference is being monitored once "
                                "per second, for a %d secs window\n", get_param.time_threshold));
                        bytes_written = snprintf(command, total_len, "%s FAIL - RSSI Threshold "
                                "%d dBm for %d out of %d times\n", CMD_GET_RSSI_LOGGING,
@@ -4168,7 +4173,7 @@ wl_android_get_rssi_logging(struct net_device *dev, char *command, int total_len
                                get_param.time_threshold);
                }
        } else {
-               WL_DBG(("[BUSY] Reprot is not ready\n"));
+               ANDROID_TRACE(("[BUSY] Reprot is not ready\n"));
                bytes_written = snprintf(command, total_len, "%s BUSY - NOT READY\n",
                        CMD_GET_RSSI_LOGGING);
        }
@@ -4802,6 +4807,7 @@ wl_handle_private_cmd(struct net_device *net, char *command, u32 cmd_len)
        else if (strnicmp(command, CMD_MAXDTIM_IN_SUSPEND, strlen(CMD_MAXDTIM_IN_SUSPEND)) == 0) {
                bytes_written = wl_android_set_max_dtim(net, command, priv_cmd.total_len);
        }
+#ifdef WL_CFG80211
        else if (strnicmp(command, CMD_SETBAND, strlen(CMD_SETBAND)) == 0) {
 #ifdef DISABLE_SETBAND
                bytes_written = BCME_DISABLED;
@@ -4813,6 +4819,7 @@ wl_handle_private_cmd(struct net_device *net, char *command, u32 cmd_len)
                        bytes_written = wl_cfg80211_set_if_band(net, band);
 #endif /* DISABLE_SETBAND */
        }
+#endif
        else if (strnicmp(command, CMD_GETBAND, strlen(CMD_GETBAND)) == 0) {
                bytes_written = wl_android_get_band(net, command, priv_cmd.total_len);
        }
index 9d6409974d87af1e97263079ed6575c5a2c47111..1a3bcb78d602f78787c55872ffe3430bb747d381 100644 (file)
@@ -920,13 +920,6 @@ struct chan_info {
 #define CFG80211_PUT_BSS(wiphy, bss) cfg80211_put_bss(bss);
 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) */
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0))
-#define ieee80211_band nl80211_band
-#define IEEE80211_BAND_2GHZ NL80211_BAND_2GHZ
-#define IEEE80211_BAND_5GHZ NL80211_BAND_5GHZ
-#define IEEE80211_NUM_BANDS NUM_NL80211_BANDS
-#endif
-
 #define CHAN2G(_channel, _freq, _flags) {                      \
        .band                   = IEEE80211_BAND_2GHZ,          \
        .center_freq            = (_freq),                      \
@@ -1178,11 +1171,13 @@ wl_chspec_from_legacy(chanspec_t legacy_chspec)
                        chspec |= WL_CHANSPEC_CTL_SB_U;
                }
        }
+
        if (wf_chspec_malformed(chspec)) {
                WL_ERR(("wl_chspec_from_legacy: output chanspec (0x%04X) malformed\n",
                        chspec));
                return INVCHANSPEC;
        }
+
        return chspec;
 }
 
@@ -1286,6 +1281,7 @@ wl_chspec_driver_to_host(chanspec_t chanspec)
        if (ioctl_version == 1) {
                chanspec = wl_chspec_from_legacy(chanspec);
        }
+
        return chanspec;
 }
 
@@ -3723,6 +3719,7 @@ wl_cfg80211_interface_ops(struct bcm_cfg80211 *cfg,
                        &iface_v3, sizeof(wl_interface_create_v3_t),
                        ioctl_buf, sizeof(ioctl_buf), NULL);
        } else {
+#if 0
                /* On any other error, attempt with iovar version 2 */
                WL_DBG(("interface_create version 2. get_ver:%d\n", ret));
                iface.ver = WL_INTERFACE_CREATE_VER_2;
@@ -3734,6 +3731,7 @@ wl_cfg80211_interface_ops(struct bcm_cfg80211 *cfg,
                ret = wldev_iovar_getbuf(ndev, "interface_create",
                        &iface, sizeof(struct wl_interface_create_v2),
                        ioctl_buf, sizeof(ioctl_buf), NULL);
+#endif
        }
 
        if (unlikely(ret)) {
@@ -14082,10 +14080,11 @@ static void wl_scan_timeout(unsigned long data)
        struct wl_bss_info *bi = NULL;
        s32 i;
        u32 channel;
-/*#if defined(DHD_DEBUG) && defined(DHD_FW_COREDUMP)
+#if 0
        dhd_pub_t *dhdp = (dhd_pub_t *)(cfg->pub);
        uint32 prev_memdump_mode = dhdp->memdump_enabled;
-#endif*/ /* DHD_DEBUG && DHD_FW_COREDUMP */
+#endif /* DHD_DEBUG && DHD_FW_COREDUMP */
+
        if (!(cfg->scan_request)) {
                WL_ERR(("timer expired but no scan request\n"));
                return;
@@ -14096,6 +14095,7 @@ static void wl_scan_timeout(unsigned long data)
                WL_ERR(("bss_list is null. Didn't receive any partial scan results\n"));
        } else {
                WL_ERR(("scanned AP count (%d)\n", bss_list->count));
+
                bi = next_bss(bss_list, bi);
                for_each_bss(bss_list, bi, i) {
                        if (bi != NULL && &(bi->chanspec) != NULL && (bi->SSID)) {
@@ -14111,6 +14111,7 @@ static void wl_scan_timeout(unsigned long data)
                        }
                }
        }
+
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0))
        if (cfg->scan_request->dev)
                wdev = cfg->scan_request->dev->ieee80211_ptr;
@@ -14123,17 +14124,17 @@ static void wl_scan_timeout(unsigned long data)
                return;
        }
        ndev = wdev_to_wlc_ndev(wdev, cfg);
+
        bzero(&msg, sizeof(wl_event_msg_t));
        WL_ERR(("timer expired\n"));
-/*#if defined(DHD_DEBUG) && defined(DHD_FW_COREDUMP)
+#if 0
        if (dhdp->memdump_enabled) {
                dhdp->memdump_enabled = DUMP_MEMFILE;
                dhdp->memdump_type = DUMP_TYPE_SCAN_TIMEOUT;
                dhd_bus_mem_dump(dhdp);
                dhdp->memdump_enabled = prev_memdump_mode;
        }
-#endif*/
- /* DHD_DEBUG && DHD_FW_COREDUMP */
+#endif /* DHD_DEBUG && DHD_FW_COREDUMP */
        msg.event_type = hton32(WLC_E_ESCAN_RESULT);
        msg.status = hton32(WLC_E_STATUS_TIMEOUT);
        msg.reason = 0xFFFFFFFF;
@@ -14142,6 +14143,7 @@ static void wl_scan_timeout(unsigned long data)
        if (!wl_scan_timeout_dbg_enabled)
                wl_scan_timeout_dbg_set();
 #endif /* CUSTOMER_HW4_DEBUG */
+
        // terence 20130729: workaround to fix out of memory in firmware
 //     if (dhd_conf_get_chip(dhd_get_pub(ndev)) == BCM43362_CHIP_ID) {
 //             WL_ERR(("Send hang event\n"));
@@ -15181,7 +15183,7 @@ static s32 wl_notifier_change_state(struct bcm_cfg80211 *cfg, struct net_info *_
                                        wl_cfg80211_update_power_mode(_net_info->ndev);
                                }
 #ifdef RTT_SUPPORT
-                        }
+                       }
 #endif /* RTT_SUPPORT */
                }
                wl_cfg80211_concurrent_roam(cfg, 0);
@@ -16380,9 +16382,6 @@ static s32 __wl_cfg80211_down(struct bcm_cfg80211 *cfg)
        unsigned long flags;
        struct net_info *iter, *next;
        struct net_device *ndev = bcmcfg_to_prmry_ndev(cfg);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0))
-        struct cfg80211_scan_info info;
-#endif
 #if defined(WL_CFG80211) && (defined(WL_ENABLE_P2P_IF) || \
        defined(WL_NEW_CFG_PRIVCMD_SUPPORT)) && !defined(PLATFORM_SLP)
        struct net_device *p2p_net = cfg->p2p_net;
@@ -16392,6 +16391,10 @@ static s32 __wl_cfg80211_down(struct bcm_cfg80211 *cfg)
        dhd_pub_t *dhd =  (dhd_pub_t *)(cfg->pub);
 #endif 
 #endif /* PROP_TXSTATUS_VSDB */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0))
+       struct cfg80211_scan_info info;
+#endif
+
        WL_DBG(("In\n"));
 
        /* Check if cfg80211 interface is already down */
@@ -17376,27 +17379,25 @@ done:
 }
 
 static bool
-wl_cfg80211_valid_chanspec_p2p(chanspec_t chanspec)
+wl_cfg80211_valid_channel_p2p(int channel)
 {
        bool valid = false;
-       char chanbuf[CHANSPEC_STR_LEN];
 
        /* channel 1 to 14 */
-       if ((chanspec >= 0x2b01) && (chanspec <= 0x2b0e)) {
+       if ((channel >= 1) && (channel <= 14)) {
                valid = true;
        }
        /* channel 36 to 48 */
-       else if ((chanspec >= 0x1b24) && (chanspec <= 0x1b30)) {
+       else if ((channel >= 36) && (channel <= 48)) {
                valid = true;
        }
        /* channel 149 to 161 */
-       else if ((chanspec >= 0x1b95) && (chanspec <= 0x1ba1)) {
+       else if ((channel >= 149) && (channel <= 161)) {
                valid = true;
        }
        else {
                valid = false;
-               WL_INFORM(("invalid P2P chanspec, chanspec = %s\n",
-                       wf_chspec_ntoa_ex(chanspec, chanbuf)));
+               WL_INFORM(("invalid P2P chanspec, channel = %d\n", channel));
        }
 
        return valid;
@@ -17461,7 +17462,7 @@ wl_cfg80211_get_chanspecs_5g(struct net_device *ndev, void *buf, s32 buflen)
                }
 
                if (CHANNEL_IS_RADAR(channel) ||
-                       !(wl_cfg80211_valid_chanspec_p2p(chanspec))) {
+                       !(wl_cfg80211_valid_channel_p2p(CHSPEC_CHANNEL(chanspec)))) {
                        continue;
                } else {
                        list->element[j] = list->element[i];
@@ -17486,7 +17487,7 @@ wl_cfg80211_get_best_channel(struct net_device *ndev, void *buf, int buflen,
        uint chip;
 
        /* Start auto channel selection scan. */
-       ret = wldev_ioctl_set(ndev, WLC_START_CHANNEL_SEL, NULL, 0);
+       ret = wldev_ioctl_set(ndev, WLC_START_CHANNEL_SEL, buf, buflen);
        if (ret < 0) {
                WL_ERR(("can't start auto channel scan, error = %d\n", ret));
                *channel = 0;
@@ -17508,7 +17509,7 @@ wl_cfg80211_get_best_channel(struct net_device *ndev, void *buf, int buflen,
                                chanspec = wl_chspec_driver_to_host(chosen);
                                printf("selected chanspec = 0x%x\n", chanspec);
                                ctl_chan = wf_chspec_ctlchan(chanspec);
-                               printf("selected ctl_chan = 0x%x\n", ctl_chan);
+                               printf("selected ctl_chan = %d\n", ctl_chan);
                                *channel = (u16)(ctl_chan & 0x00FF);
                        } else
                                *channel = (u16)(chosen & 0x00FF);
@@ -17524,6 +17525,7 @@ wl_cfg80211_get_best_channel(struct net_device *ndev, void *buf, int buflen,
                *channel = 0;
                ret = BCME_ERROR;
        }
+       WL_INFORM(("selected channel = %d\n", *channel));
 
 done:
        return ret;
@@ -17591,17 +17593,19 @@ wl_cfg80211_get_best_channels(struct net_device *dev, char* cmd, int total_len)
                }
 
                if (CHANNEL_IS_2G(channel)) {
+#if 0
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) && !defined(WL_COMPAT_WIRELESS)
                        channel = ieee80211_channel_to_frequency(channel);
 #else
                        channel = ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
+#endif
 #endif
                } else {
                        WL_ERR(("invalid 2.4GHz channel, channel = %d\n", channel));
                        channel = 0;
                }
+               pos += snprintf(pos, total_len, "2g=%d ", channel);
        }
-       pos += snprintf(pos, total_len, "%04d ", channel);
 
        if (band_cur != WLC_BAND_2G) {
                // terence 20140120: fix for some chipsets only return 2.4GHz channel (4330b2/43341b0/4339a0)
@@ -17625,17 +17629,12 @@ wl_cfg80211_get_best_channels(struct net_device *dev, char* cmd, int total_len)
                }
 
                if (CHANNEL_IS_5G(channel)) {
-                       channel = ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
-               } else {
-                       WL_ERR(("invalid 5GHz channel, channel = %d\n", channel));
-                       channel = 0;
-               }
-
-               if (CHANNEL_IS_5G(channel)) {
+#if 0
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) && !defined(WL_COMPAT_WIRELESS)
                        channel = ieee80211_channel_to_frequency(channel);
 #else
                        channel = ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
+#endif
 #endif
                } else {
                        WL_ERR(("invalid 5GHz channel, channel = %d\n", channel));
@@ -17645,11 +17644,8 @@ wl_cfg80211_get_best_channels(struct net_device *dev, char* cmd, int total_len)
                ret = wldev_ioctl(dev, WLC_SET_BAND, &band_cur, sizeof(band_cur), true);
                if (ret < 0)
                        WL_ERR(("WLC_SET_BAND error %d\n", ret));
+               pos += snprintf(pos, total_len, "5g=%d ", channel);
        }
-       pos += snprintf(pos, total_len, "%04d ", channel);
-
-       /* Set overall best channel same as 5GHz best channel. */
-       pos += snprintf(pos, total_len, "%04d ", channel);
 
 done:
        if (NULL != buf) {
@@ -17662,7 +17658,7 @@ done:
                WL_ERR(("can't restore auto channel scan state, error = %d\n", ret));
        }
 
-       printf("%s: channel %s\n", __FUNCTION__, cmd);
+       printf("%s: %s\n", __FUNCTION__, cmd);
 
        return (pos - cmd);
 }
index f002166d49de31a837ef2432e6cffe22f656fd31..9d06534db7cd371c321435203195485ae7c1e45c 100644 (file)
@@ -199,6 +199,12 @@ do {                                                                       \
 #define WL_PNO(x)
 #define WL_SD(x)
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0))
+#define ieee80211_band nl80211_band
+#define IEEE80211_BAND_2GHZ NL80211_BAND_2GHZ
+#define IEEE80211_BAND_5GHZ NL80211_BAND_5GHZ
+#define IEEE80211_NUM_BANDS NUM_NL80211_BANDS
+#endif
 
 #define WL_SCAN_RETRY_MAX      3
 #define WL_NUM_PMKIDS_MAX      MAXPMKID
index 9bf7084010f9baeada9c38c3336ce5c5cd9eca8a..8806a5f4f1f5e58865d949a88f7b5f0b913cae32 100644 (file)
@@ -252,7 +252,7 @@ wl_cfgvendor_set_country(struct wiphy *wiphy,
        int err = BCME_ERROR, rem, type;
        char country_code[WLC_CNTRY_BUF_SZ] = {0};
        const struct nlattr *iter;
-
+       WL_ERR(("enter wl_cfgvendor_set_country: \n"));
        nla_for_each_attr(iter, data, len, rem) {
                type = nla_type(iter);
                switch (type) {
@@ -267,6 +267,7 @@ wl_cfgvendor_set_country(struct wiphy *wiphy,
        }
 
        err = wldev_set_country(wdev->netdev, country_code, true, true, -1);
+       WL_ERR(("Set country code ret:%d\n", err));
        if (err < 0) {
                WL_ERR(("Set country failed ret:%d\n", err));
        }
@@ -2203,7 +2204,11 @@ static int wl_cfgvendor_lstats_get_info(struct wiphy *wiphy,
        wlc_rev_info_t revinfo;
 #ifdef CONFIG_COMPAT
        compat_wifi_iface_stat compat_iface;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0))
+       int compat_task_state = in_compat_syscall();
+#else
        int compat_task_state = is_compat_task();
+#endif
 #endif /* CONFIG_COMPAT */
 
        WL_INFORM(("%s: Enter \n", __func__));
@@ -2563,7 +2568,12 @@ wl_cfgvendor_dbg_get_mem_dump(struct wiphy *wiphy,
                        goto free_mem;
                }
 #ifdef CONFIG_COMPAT
-               if (is_compat_task()) {
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0))
+               if (in_compat_syscall())
+#else
+               if (is_compat_task())
+#endif
+               {
                        void * usr_ptr =  compat_ptr((uintptr_t) user_buf);
                        ret = copy_to_user(usr_ptr, mem_buf, buf_len);
                        if (ret) {
@@ -2737,9 +2747,9 @@ static int wl_cfgvendor_dbg_get_feature(struct wiphy *wiphy,
        ret = wl_cfgvendor_send_cmd_reply(wiphy, bcmcfg_to_prmry_ndev(cfg),
                &supported_features, sizeof(supported_features));
        if (ret < 0) {
-                WL_ERR(("wl_cfgvendor_send_cmd_reply failed ret:%d\n", ret));
-                goto exit;
-        }
+               WL_ERR(("wl_cfgvendor_send_cmd_reply failed ret:%d\n", ret));
+               goto exit;
+       }
 exit:
        return ret;
 }
index d6425b9eb9422f28f0f18ee58f7c7512f1707ebb..f9be06301ba64e850a48f5438b83b3cf33de13f2 100644 (file)
@@ -4,6 +4,9 @@
 #include <typedefs.h>
 #include <linuxver.h>
 #include <osl.h>
+#include <dngl_stats.h>
+#include <dhd.h>
+
 #include <bcmutils.h>
 #include <bcmendian.h>
 #include <ethernet.h>
@@ -1393,7 +1396,7 @@ err:
        return err;
 }
 
-void wl_escan_detach(void)
+void wl_escan_detach(dhd_pub_t *dhdp)
 {
        struct wl_escan_info *escan = g_escan;
 
@@ -1410,14 +1413,12 @@ void wl_escan_detach(void)
                kfree(escan->escan_ioctl_buf);
                escan->escan_ioctl_buf = NULL;
        }
-#ifndef CONFIG_DHD_USE_STATIC_BUF
-       kfree(escan);
-#endif
+       DHD_OS_PREFREE(dhdp, escan, sizeof(struct wl_escan_info));
        g_escan = NULL;
 }
 
 int
-wl_escan_attach(struct net_device *dev, void * dhdp)
+wl_escan_attach(struct net_device *dev, dhd_pub_t *dhdp)
 {
        struct wl_escan_info *escan = NULL;
 
@@ -1425,11 +1426,7 @@ wl_escan_attach(struct net_device *dev, void * dhdp)
 
        if (!dev)
                return 0;
-#ifdef CONFIG_DHD_USE_STATIC_BUF
-       escan = bcm_wlan_prealloc(DHD_PREALLOC_WL_ESCAN_INFO, sizeof(struct wl_escan_info));
-#else
-       escan = kmalloc(sizeof(struct wl_escan_info), GFP_KERNEL);
-#endif
+       escan = (wl_escan_info_t *)DHD_OS_PREALLOC(dhdp, DHD_PREALLOC_WL_ESCAN_INFO, sizeof(struct wl_escan_info));
        if (!escan)
                return -ENOMEM;
        memset(escan, 0, sizeof(struct wl_escan_info));
@@ -1452,7 +1449,7 @@ wl_escan_attach(struct net_device *dev, void * dhdp)
 
        return 0;
 err:
-       wl_escan_detach();
+       wl_escan_detach(dhdp);
        return -ENOMEM;
 }
 
index 6be090acae8ecfc91a9b25c536d839644c0ec60f..04255d4e2d04e7fdd69d064c820fa2829ffcd4c8 100644 (file)
@@ -68,8 +68,8 @@ int wl_escan_set_scan(
 );\r
 int wl_escan_get_scan(struct net_device *dev,  struct iw_request_info *info,\r
        struct iw_point *dwrq, char *extra);\r
-int wl_escan_attach(struct net_device *dev, void * dhdp);\r
-void wl_escan_detach(void);\r
+int wl_escan_attach(struct net_device *dev, dhd_pub_t *dhdp);\r
+void wl_escan_detach(dhd_pub_t *dhdp);\r
 \r
 #endif /* _wl_escan_ */\r
 \r
index b7161beecc0e856f3cc1af682b5c20072367943c..a817c0122fedbd54bd2b2aa9e29bdbaaaec33a30 100644 (file)
@@ -599,9 +599,9 @@ wl_iw_set_freq(
                                fwrq->m /= 10;
                }
        /* handle 4.9GHz frequencies as Japan 4 GHz based channelization */
-       if (fwrq->m > 4000 && fwrq->m < 5000) {
-               sf = WF_CHAN_FACTOR_4_G; /* start factor for 4 GHz */
-       }
+               if (fwrq->m > 4000 && fwrq->m < 5000) {
+                       sf = WF_CHAN_FACTOR_4_G; /* start factor for 4 GHz */
+               }
                chan = wf_mhz2channel(fwrq->m, sf);
        }
        WL_ERROR(("%s: chan=%d\n", __FUNCTION__, chan));