From bd23d4cbe5aa1915b2dbcdd3790f00baf533bf33 Mon Sep 17 00:00:00 2001 From: Rongjun Chen Date: Tue, 21 Nov 2017 11:19:02 +0800 Subject: [PATCH] wifi: add ap6398 ap6256 ap6236 support Change-Id: Ib8c200a6dfd6daeeb901ae79e28ccad9a26f8d47 Signed-off-by: Rongjun Chen --- bcmdhd.1.363.59.144.x.cn/dhd.h | 2 +- bcmdhd.1.363.59.144.x.cn/dhd_config.c | 75 +++++++++--- bcmdhd.1.363.59.144.x.cn/dhd_config.h | 9 +- bcmdhd.1.363.59.144.x.cn/dhd_linux.c | 16 ++- bcmdhd.1.363.59.144.x.cn/dhd_msgbuf.c | 24 +++- bcmdhd.1.363.59.144.x.cn/dhd_pcie.c | 64 +++++++++- bcmdhd.1.363.59.144.x.cn/dhd_pcie.h | 1 + bcmdhd.1.363.59.144.x.cn/dhd_pcie_linux.c | 8 +- bcmdhd.1.363.59.144.x.cn/dhd_sdio.c | 29 ++++- bcmdhd.1.363.59.144.x.cn/include/epivers.h | 2 +- bcmdhd.1.579.77.41.1.cn/Makefile | 35 +++--- bcmdhd.1.579.77.41.1.cn/bcmsdh_sdmmc.c | 12 -- bcmdhd.1.579.77.41.1.cn/dhd.h | 2 +- bcmdhd.1.579.77.41.1.cn/dhd_config.c | 133 ++++++++++++++------- bcmdhd.1.579.77.41.1.cn/dhd_config.h | 16 ++- bcmdhd.1.579.77.41.1.cn/dhd_gpio.c | 23 ++-- bcmdhd.1.579.77.41.1.cn/dhd_linux.c | 20 +++- bcmdhd.1.579.77.41.1.cn/dhd_msgbuf.c | 23 +++- bcmdhd.1.579.77.41.1.cn/dhd_pcie.c | 42 +++++++ bcmdhd.1.579.77.41.1.cn/dhd_pcie.h | 1 + bcmdhd.1.579.77.41.1.cn/dhd_pcie_linux.c | 15 +++ bcmdhd.1.579.77.41.1.cn/dhd_pno.c | 3 + bcmdhd.1.579.77.41.1.cn/dhd_sdio.c | 31 ++++- bcmdhd.1.579.77.41.1.cn/dhd_static_buf.c | 2 +- bcmdhd.1.579.77.41.1.cn/include/wlioctl.h | 7 -- bcmdhd.1.579.77.41.1.cn/wl_cfg80211.c | 2 +- 26 files changed, 462 insertions(+), 135 deletions(-) diff --git a/bcmdhd.1.363.59.144.x.cn/dhd.h b/bcmdhd.1.363.59.144.x.cn/dhd.h index 135c92f..975586e 100644 --- a/bcmdhd.1.363.59.144.x.cn/dhd.h +++ b/bcmdhd.1.363.59.144.x.cn/dhd.h @@ -968,7 +968,7 @@ extern void dhd_os_dhdiovar_lock(dhd_pub_t *pub); extern void dhd_os_dhdiovar_unlock(dhd_pub_t *pub); extern int dhd_os_proto_block(dhd_pub_t * pub); extern int dhd_os_proto_unblock(dhd_pub_t * pub); -extern int dhd_os_ioctl_resp_wait(dhd_pub_t * pub, uint * condition); +extern int dhd_os_ioctl_resp_wait(dhd_pub_t * pub, uint * condition, bool resched); extern int dhd_os_ioctl_resp_wake(dhd_pub_t * pub); extern unsigned int dhd_os_get_ioctl_resp_timeout(void); extern void dhd_os_set_ioctl_resp_timeout(unsigned int timeout_msec); diff --git a/bcmdhd.1.363.59.144.x.cn/dhd_config.c b/bcmdhd.1.363.59.144.x.cn/dhd_config.c index 0683804..8270d1f 100644 --- a/bcmdhd.1.363.59.144.x.cn/dhd_config.c +++ b/bcmdhd.1.363.59.144.x.cn/dhd_config.c @@ -81,7 +81,7 @@ uint config_msg_level = CONFIG_ERROR_LEVEL; #define FW_BCM43438A0 "fw_bcm43438a0" #define FW_BCM43438A1 "fw_bcm43438a1" #define FW_BCM43436B0 "fw_bcm43436b0" -#define FW_BCM43012B0 "fw_bcm43012b0" +#define FW_BCM43013B0 "fw_bcm43013b0" #define FW_BCM43341B1 "fw_bcm43341b0_ag" #define FW_BCM43241B4 "fw_bcm43241b4_ag" #define FW_BCM4339A0 "fw_bcm4339a0_ag" @@ -93,7 +93,7 @@ uint config_msg_level = CONFIG_ERROR_LEVEL; #define FW_BCM4359B1 "fw_bcm4359b1_ag" #define FW_BCM4359C0 "fw_bcm4359c0_ag" -#define CLM_BCM43012B0 "clm_bcm43012b0" +#define CLM_BCM43013B0 "clm_bcm43013b0" #endif #ifdef BCMPCIE #define FW_BCM4356A2 "fw_bcm4356a2_pcie_ag" @@ -427,8 +427,8 @@ dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path) strcpy(&fw_path[i+1], FW_BCM43436B0); break; case BCM43012_CHIP_ID: - if (chiprev == BCM43012B0_CHIP_REV) - strcpy(&fw_path[i+1], FW_BCM43012B0); + if (chiprev == BCM43013B0_CHIP_REV) + strcpy(&fw_path[i+1], FW_BCM43013B0); break; case BCM4334_CHIP_ID: if (chiprev == BCM4334B1_CHIP_REV) @@ -522,8 +522,8 @@ dhd_conf_set_clm_name_by_chip(dhd_pub_t *dhd, char *clm_path) switch (chip) { #ifdef BCMSDIO case BCM43012_CHIP_ID: - if (chiprev == BCM43012B0_CHIP_REV) - strcpy(&clm_path[i+1], CLM_BCM43012B0); + if (chiprev == BCM43013B0_CHIP_REV) + strcpy(&clm_path[i+1], CLM_BCM43013B0); break; #endif default: @@ -1969,13 +1969,6 @@ dhd_conf_read_sdio_params(dhd_pub_t *dhd, char *full_param, uint len_param) conf->bus_rxglom = TRUE; printf("%s: bus:rxglom = %d\n", __FUNCTION__, conf->bus_rxglom); } - else if (!strncmp("dhd_poll=", full_param, len_param)) { - if (!strncmp(data, "0", 1)) - conf->dhd_poll = 0; - else - conf->dhd_poll = 1; - printf("%s: dhd_poll = %d\n", __FUNCTION__, conf->dhd_poll); - } else if (!strncmp("deferred_tx_len=", full_param, len_param)) { conf->deferred_tx_len = (int)simple_strtol(data, NULL, 10); printf("%s: deferred_tx_len = %d\n", __FUNCTION__, conf->deferred_tx_len); @@ -2013,6 +2006,27 @@ dhd_conf_read_sdio_params(dhd_pub_t *dhd, char *full_param, uint len_param) } #endif +#ifdef BCMPCIE +bool +dhd_conf_read_pcie_params(dhd_pub_t *dhd, char *full_param, uint len_param) +{ + struct dhd_conf *conf = dhd->conf; + char *data = full_param+len_param; + + if (!strncmp("bus:deepsleep_disable=", full_param, len_param)) { + if (!strncmp(data, "0", 1)) + conf->bus_deepsleep_disable = 0; + else + conf->bus_deepsleep_disable = 1; + printf("%s: bus:deepsleep_disable = %d\n", __FUNCTION__, conf->bus_deepsleep_disable); + } + else + return false; + + return true; +} +#endif + bool dhd_conf_read_pm_params(dhd_pub_t *dhd, char *full_param, uint len_param) { @@ -2068,7 +2082,18 @@ dhd_conf_read_others(dhd_pub_t *dhd, char *full_param, uint len_param) char *pch, *pick_tmp; int i; - if (!strncmp("band=", full_param, len_param)) { + if (!strncmp("dhd_poll=", full_param, len_param)) { + if (!strncmp(data, "0", 1)) + conf->dhd_poll = 0; + else + conf->dhd_poll = 1; + printf("%s: dhd_poll = %d\n", __FUNCTION__, conf->dhd_poll); + } + else if (!strncmp("dhd_watchdog_ms=", full_param, len_param)) { + dhd_watchdog_ms = (int)simple_strtol(data, NULL, 10); + printf("%s: dhd_watchdog_ms = %d\n", __FUNCTION__, dhd_watchdog_ms); + } + else if (!strncmp("band=", full_param, len_param)) { /* Process band: * band=a for 5GHz only and band=b for 2.4GHz only */ @@ -2207,6 +2232,14 @@ dhd_conf_read_others(dhd_pub_t *dhd, char *full_param, uint len_param) conf->tsq = (int)simple_strtol(data, NULL, 10); printf("%s: tsq = %d\n", __FUNCTION__, conf->tsq); } + else if (!strncmp("ctrl_resched=", full_param, len_param)) { + conf->ctrl_resched = (int)simple_strtol(data, NULL, 10); + printf("%s: ctrl_resched = %d\n", __FUNCTION__, conf->ctrl_resched); + } + else if (!strncmp("dhd_ioctl_timeout_msec=", full_param, len_param)) { + conf->dhd_ioctl_timeout_msec = (int)simple_strtol(data, NULL, 10); + printf("%s: dhd_ioctl_timeout_msec = %d\n", __FUNCTION__, conf->dhd_ioctl_timeout_msec); + } else return false; @@ -2305,6 +2338,10 @@ dhd_conf_read_config(dhd_pub_t *dhd, char *conf_path) else if (dhd_conf_read_sdio_params(dhd, pick, len_param)) continue; #endif /* BCMSDIO */ +#ifdef BCMPCIE + else if (dhd_conf_read_pcie_params(dhd, pick, len_param)) + continue; +#endif /* BCMPCIE */ else if (dhd_conf_read_pm_params(dhd, pick, len_param)) continue; else if (dhd_conf_read_others(dhd, pick, len_param)) @@ -2410,6 +2447,7 @@ int dhd_conf_preinit(dhd_pub_t *dhd) { struct dhd_conf *conf = dhd->conf; +// int i; CONFIG_TRACE(("%s: Enter\n", __FUNCTION__)); @@ -2484,6 +2522,7 @@ dhd_conf_preinit(dhd_pub_t *dhd) conf->txbf = -1; conf->lpc = -1; conf->disable_proptx = -1; + conf->dhd_poll = -1; #ifdef BCMSDIO conf->bus_txglom = -1; conf->use_rxchain = 0; @@ -2491,7 +2530,6 @@ dhd_conf_preinit(dhd_pub_t *dhd) conf->txglom_ext = FALSE; conf->tx_max_offset = 0; conf->txglomsize = SDPCM_DEFGLOM_SIZE; - conf->dhd_poll = -1; conf->txctl_tmo_fix = FALSE; conf->tx_in_rx = TRUE; conf->txglom_mode = SDPCM_TXGLOM_MDESC; @@ -2500,6 +2538,9 @@ dhd_conf_preinit(dhd_pub_t *dhd) conf->txinrx_thres = -1; conf->sd_f2_blocksize = 0; conf->oob_enabled_later = FALSE; +#endif +#ifdef BCMPCIE + conf->bus_deepsleep_disable = -1; #endif conf->ampdu_ba_wsize = 0; conf->ampdu_hostreorder = -1; @@ -2529,6 +2570,8 @@ dhd_conf_preinit(dhd_pub_t *dhd) conf->rsdb_mode = -2; conf->vhtmode = -1; conf->autocountry = -1; + conf->ctrl_resched = 2; + conf->dhd_ioctl_timeout_msec = 0; #ifdef IAPSTA_PREINIT memset(conf->iapsta_init, 0, sizeof(conf->iapsta_init)); memset(conf->iapsta_config, 0, sizeof(conf->iapsta_config)); @@ -2547,7 +2590,9 @@ dhd_conf_preinit(dhd_pub_t *dhd) conf->chip == BCM4371_CHIP_ID || conf->chip == BCM43569_CHIP_ID || conf->chip == BCM4359_CHIP_ID) { #ifdef DHDTCPACK_SUPPRESS +#ifdef BCMSDIO conf->tcpack_sup_mode = TCPACK_SUP_REPLACE; +#endif #endif dhd_rxbound = 128; dhd_txbound = 64; diff --git a/bcmdhd.1.363.59.144.x.cn/dhd_config.h b/bcmdhd.1.363.59.144.x.cn/dhd_config.h index a0e723a..7e2c654 100644 --- a/bcmdhd.1.363.59.144.x.cn/dhd_config.h +++ b/bcmdhd.1.363.59.144.x.cn/dhd_config.h @@ -23,7 +23,7 @@ extern uint dhd_slpauto; #define BCM43430A0_CHIP_REV 0 #define BCM43430A1_CHIP_REV 1 #define BCM43430A2_CHIP_REV 2 -#define BCM43012B0_CHIP_REV 1 +#define BCM43013B0_CHIP_REV 1 #define BCM4330B2_CHIP_REV 4 #define BCM4334B1_CHIP_REV 3 #define BCM43341B0_CHIP_REV 2 @@ -137,6 +137,7 @@ typedef struct dhd_conf { int txbf; int lpc; int disable_proptx; + int dhd_poll; #ifdef BCMSDIO int bus_txglom; int use_rxchain; @@ -149,7 +150,6 @@ typedef struct dhd_conf { */ int tx_max_offset; uint txglomsize; - int dhd_poll; bool txctl_tmo_fix; bool tx_in_rx; bool txglom_mode; @@ -164,6 +164,9 @@ typedef struct dhd_conf { int dhd_txminmax; // -1=DATABUFCNT(bus) uint sd_f2_blocksize; bool oob_enabled_later; +#endif +#ifdef BCMPCIE + int bus_deepsleep_disable; #endif int ampdu_ba_wsize; int ampdu_hostreorder; @@ -202,6 +205,8 @@ typedef struct dhd_conf { char iapsta_enable[50]; #endif int autocountry; + int ctrl_resched; + int dhd_ioctl_timeout_msec; int tsq; } dhd_conf_t; diff --git a/bcmdhd.1.363.59.144.x.cn/dhd_linux.c b/bcmdhd.1.363.59.144.x.cn/dhd_linux.c index c04d185..ffb18a0 100644 --- a/bcmdhd.1.363.59.144.x.cn/dhd_linux.c +++ b/bcmdhd.1.363.59.144.x.cn/dhd_linux.c @@ -9118,6 +9118,9 @@ dhd_preinit_ioctls(dhd_pub_t *dhd) // terence 20151210: set bus:txglom after dhd_txglom_enable since it's possible changed in dhd_conf_set_txglom_params dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "bus:txglom", dhd->conf->bus_txglom, 0, FALSE); #endif /* defined(BCMSDIO) */ +#if defined(BCMPCIE) + dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "bus:deepsleep_disable", dhd->conf->bus_deepsleep_disable, 0, FALSE); +#endif /* defined(BCMPCIE) */ #if defined(BCMSDIO) #ifdef PROP_TXSTATUS @@ -10288,10 +10291,15 @@ dhd_os_set_ioctl_resp_timeout(unsigned int timeout_msec) } int -dhd_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition) +dhd_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition, bool resched) { dhd_info_t * dhd = (dhd_info_t *)(pub->info); - int timeout; + int timeout, timeout_tmp = dhd_ioctl_timeout_msec; + + if (!resched && pub->conf->ctrl_resched>0 && pub->conf->dhd_ioctl_timeout_msec>0) { + timeout_tmp = dhd_ioctl_timeout_msec; + dhd_ioctl_timeout_msec = pub->conf->dhd_ioctl_timeout_msec; + } /* Convert timeout in millsecond to jiffies */ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) @@ -10304,6 +10312,10 @@ dhd_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition) timeout = wait_event_timeout(dhd->ioctl_resp_wait, (*condition), timeout); + if (!resched && pub->conf->ctrl_resched>0 && pub->conf->dhd_ioctl_timeout_msec>0) { + dhd_ioctl_timeout_msec = timeout_tmp; + } + DHD_PERIM_LOCK(pub); return timeout; diff --git a/bcmdhd.1.363.59.144.x.cn/dhd_msgbuf.c b/bcmdhd.1.363.59.144.x.cn/dhd_msgbuf.c index 3bd9a45..3dce3b6 100644 --- a/bcmdhd.1.363.59.144.x.cn/dhd_msgbuf.c +++ b/bcmdhd.1.363.59.144.x.cn/dhd_msgbuf.c @@ -52,6 +52,7 @@ #include #include #include +#include #if defined(DHD_LB) #include @@ -4695,6 +4696,7 @@ dhd_msgbuf_wait_ioctl_cmplt(dhd_pub_t *dhd, uint32 len, void *buf) int timeleft; unsigned long flags; int ret = 0; + static uint cnt = 0; DHD_TRACE(("%s: Enter\n", __FUNCTION__)); @@ -4709,7 +4711,27 @@ dhd_msgbuf_wait_ioctl_cmplt(dhd_pub_t *dhd, uint32 len, void *buf) dhd_msgbuf_rxbuf_post_ioctlresp_bufs(dhd); - timeleft = dhd_os_ioctl_resp_wait(dhd, &prot->ioctl_received); + timeleft = dhd_os_ioctl_resp_wait(dhd, &prot->ioctl_received, false); + + if (dhd->conf->ctrl_resched > 0 && timeleft == 0) { + cnt++; + if (cnt <= dhd->conf->ctrl_resched) { + uint32 intstatus = 0, intmask = 0; + intstatus = si_corereg(dhd->bus->sih, dhd->bus->sih->buscoreidx, PCIMailBoxInt, 0, 0); + intmask = si_corereg(dhd->bus->sih, dhd->bus->sih->buscoreidx, PCIMailBoxMask, 0, 0); + if (intstatus) { + DHD_ERROR(("%s: reschedule dhd_dpc, cnt=%d, intstatus=0x%x, intmask=0x%x\n", + __FUNCTION__, cnt, intstatus, intmask)); + dhd->bus->ipend = TRUE; + dhd->bus->dpc_sched = TRUE; + dhd_sched_dpc(dhd); + timeleft = dhd_os_ioctl_resp_wait(dhd, &prot->ioctl_received, true); + } + } + } else { + cnt = 0; + } + if (timeleft == 0) { dhd->rxcnt_timeout++; dhd->rx_ctlerrs++; diff --git a/bcmdhd.1.363.59.144.x.cn/dhd_pcie.c b/bcmdhd.1.363.59.144.x.cn/dhd_pcie.c index fb29fd8..1a3a61a 100644 --- a/bcmdhd.1.363.59.144.x.cn/dhd_pcie.c +++ b/bcmdhd.1.363.59.144.x.cn/dhd_pcie.c @@ -437,7 +437,9 @@ uint32 dhdpcie_bus_intstatus(dhd_bus_t *bus) { uint32 intstatus = 0; +#ifndef DHD_READ_INTSTATUS_IN_DPC uint32 intmask = 0; +#endif /* DHD_READ_INTSTATUS_IN_DPC */ if ((bus->sih->buscorerev == 6) || (bus->sih->buscorerev == 4) || (bus->sih->buscorerev == 2)) { @@ -448,6 +450,7 @@ dhdpcie_bus_intstatus(dhd_bus_t *bus) /* this is a PCIE core register..not a config register... */ intstatus = si_corereg(bus->sih, bus->sih->buscoreidx, PCIMailBoxInt, 0, 0); +#ifndef DHD_READ_INTSTATUS_IN_DPC /* this is a PCIE core register..not a config register... */ intmask = si_corereg(bus->sih, bus->sih->buscoreidx, PCIMailBoxMask, 0, 0); @@ -461,6 +464,7 @@ dhdpcie_bus_intstatus(dhd_bus_t *bus) intstatus); intstatus &= intmask; +#endif /* DHD_READ_INTSTATUS_IN_DPC */ /* Is device removed. intstatus & intmask read 0xffffffff */ if (intstatus == (uint32)-1) { @@ -474,6 +478,16 @@ dhdpcie_bus_intstatus(dhd_bus_t *bus) #endif /* CUSTOMER_HW4_DEBUG */ } +#ifdef DHD_READ_INTSTATUS_IN_DPC + /* + * The fourth argument to si_corereg is the "mask" fields of the register to update + * and the fifth field is the "value" to update. Now if we are interested in only + * few fields of the "mask" bit map, we should not be writing back what we read + * By doing so, we might clear/ack interrupts that are not handled yet. + */ + si_corereg(bus->sih, bus->sih->buscoreidx, PCIMailBoxInt, bus->def_intmask, + intstatus); +#endif /* DHD_READ_INTSTATUS_IN_DPC */ intstatus &= bus->def_intmask; } @@ -495,7 +509,9 @@ dhdpcie_bus_intstatus(dhd_bus_t *bus) int32 dhdpcie_bus_isr(dhd_bus_t *bus) { +#ifndef DHD_READ_INTSTATUS_IN_DPC uint32 intstatus = 0; +#endif /* DHD_READ_INTSTATUS_IN_DPC */ do { DHD_TRACE(("%s: Enter\n", __FUNCTION__)); @@ -515,6 +531,7 @@ dhdpcie_bus_isr(dhd_bus_t *bus) break; } +#ifndef DHD_READ_INTSTATUS_IN_DPC intstatus = dhdpcie_bus_intstatus(bus); /* Check if the interrupt is ours or not */ @@ -534,6 +551,7 @@ dhdpcie_bus_isr(dhd_bus_t *bus) /* Count the interrupt call */ bus->intrcount++; +#endif /* DHD_READ_INTSTATUS_IN_DPC */ /* read interrupt status register!! Status bits will be cleared in DPC !! */ bus->ipend = TRUE; @@ -702,6 +720,8 @@ dhdpcie_dongle_attach(dhd_bus_t *bus) /* Set the poll and/or interrupt flags */ bus->intr = (bool)dhd_intr; + if ((bus->poll = (bool)dhd_poll)) + bus->pollrate = 1; bus->wait_for_d3_ack = 1; bus->suspended = FALSE; @@ -1047,7 +1067,6 @@ done: bool dhd_bus_watchdog(dhd_pub_t *dhd) { unsigned long flags; -#ifdef DHD_DEBUG dhd_bus_t *bus; bus = dhd->bus; @@ -1060,6 +1079,7 @@ bool dhd_bus_watchdog(dhd_pub_t *dhd) dhd->dhd_bus_busy_state |= DHD_BUS_BUSY_IN_WD; DHD_GENERAL_UNLOCK(dhd, flags); +#ifdef DHD_DEBUG #ifdef DHD_PCIE_RUNTIMEPM dhdpcie_runtime_bus_wake(dhd, TRUE, __builtin_return_address(0)); #endif /* DHD_PCIE_RUNTIMEPM */ @@ -1078,6 +1098,14 @@ bool dhd_bus_watchdog(dhd_pub_t *dhd) } #endif /* DHD_DEBUG */ +#ifdef DHD_READ_INTSTATUS_IN_DPC + if (bus->poll) { + bus->ipend = TRUE; + bus->dpc_sched = TRUE; + dhd_sched_dpc(bus->dhd); /* queue DPC now!! */ + } +#endif /* DHD_READ_INTSTATUS_IN_DPC */ + #ifdef PCIE_OOB /* If haven't communicated with device for a while, deassert the Device_Wake GPIO */ if (dhd_doorbell_timeout != 0 && !(bus->dhd->busstate == DHD_BUS_SUSPEND) && @@ -1243,13 +1271,12 @@ dhd_set_path_params(struct dhd_bus *bus) /* External conf takes precedence if specified */ dhd_conf_preinit(bus->dhd); - if (bus->dhd->clm_path[0] == '\0') { - dhd_conf_set_path(bus->dhd, "clm.blob", bus->dhd->clm_path, bus->fw_path); - } - dhd_conf_set_clm_name_by_chip(bus->dhd, bus->dhd->clm_path); if (bus->dhd->conf_path[0] == '\0') { dhd_conf_set_path(bus->dhd, "config.txt", bus->dhd->conf_path, bus->nv_path); } + if (bus->dhd->clm_path[0] == '\0') { + dhd_conf_set_path(bus->dhd, "clm.blob", bus->dhd->clm_path, bus->fw_path); + } #ifdef CONFIG_PATH_AUTO_SELECT dhd_conf_set_conf_name_by_chip(bus->dhd, bus->dhd->conf_path); #endif @@ -1267,6 +1294,17 @@ dhd_set_path_params(struct dhd_bus *bus) } +void +dhd_set_bus_params(struct dhd_bus *bus) +{ + if (bus->dhd->conf->dhd_poll >= 0) { + bus->poll = bus->dhd->conf->dhd_poll; + if (!bus->pollrate) + bus->pollrate = 1; + printf("%s: set polling mode %d\n", __FUNCTION__, bus->dhd->conf->dhd_poll); + } +} + static int dhdpcie_download_firmware(struct dhd_bus *bus, osl_t *osh) { @@ -1308,6 +1346,7 @@ dhdpcie_download_firmware(struct dhd_bus *bus, osl_t *osh) DHD_OS_WAKE_LOCK(bus->dhd); dhd_set_path_params(bus); + dhd_set_bus_params(bus); ret = _dhdpcie_download_firmware(bus); @@ -4753,9 +4792,24 @@ dhd_bus_dpc(struct dhd_bus *bus) bus->dhd->dhd_bus_busy_state |= DHD_BUS_BUSY_IN_DPC; DHD_GENERAL_UNLOCK(bus->dhd, flags); +#ifdef DHD_READ_INTSTATUS_IN_DPC + if (bus->ipend) { + bus->ipend = FALSE; + bus->intstatus = dhdpcie_bus_intstatus(bus); + /* Check if the interrupt is ours or not */ + if (bus->intstatus == 0) { + goto INTR_ON; + } + bus->intrcount++; + } +#endif /* DHD_READ_INTSTATUS_IN_DPC */ + resched = dhdpcie_bus_process_mailbox_intr(bus, bus->intstatus); if (!resched) { bus->intstatus = 0; +#ifdef DHD_READ_INTSTATUS_IN_DPC +INTR_ON: +#endif /* DHD_READ_INTSTATUS_IN_DPC */ if (!bus->pci_d3hot_done) { dhdpcie_bus_intr_enable(bus); } else { diff --git a/bcmdhd.1.363.59.144.x.cn/dhd_pcie.h b/bcmdhd.1.363.59.144.x.cn/dhd_pcie.h index dc65947..cb2fbc0 100644 --- a/bcmdhd.1.363.59.144.x.cn/dhd_pcie.h +++ b/bcmdhd.1.363.59.144.x.cn/dhd_pcie.h @@ -164,6 +164,7 @@ typedef struct dhd_bus { struct pktq txq; /* Queue length used for flow-control */ bool intr; /* Use interrupts */ + bool poll; /* Use polling */ bool ipend; /* Device interrupt is pending */ bool intdis; /* Interrupts disabled by isr */ uint intrcount; /* Count of device interrupt callbacks */ diff --git a/bcmdhd.1.363.59.144.x.cn/dhd_pcie_linux.c b/bcmdhd.1.363.59.144.x.cn/dhd_pcie_linux.c index c1c054c..2e7b61f 100644 --- a/bcmdhd.1.363.59.144.x.cn/dhd_pcie_linux.c +++ b/bcmdhd.1.363.59.144.x.cn/dhd_pcie_linux.c @@ -616,7 +616,13 @@ dhdpcie_request_irq(dhdpcie_info_t *dhdpcie_info) snprintf(dhdpcie_info->pciname, sizeof(dhdpcie_info->pciname), "dhdpcie:%s", pci_name(pdev)); #ifdef DHD_USE_MSI - pci_enable_msi(pdev); + printf("%s: MSI enabled\n", __FUNCTION__); + err = pci_enable_msi(pdev); + if (err < 0) { + DHD_ERROR(("%s: pci_enable_msi() failed, %d, fall back to INTx\n", __FUNCTION__, err)); + } +#else + printf("%s: MSI not enabled\n", __FUNCTION__); #endif /* DHD_USE_MSI */ err = request_irq(pdev->irq, dhdpcie_isr, IRQF_SHARED, dhdpcie_info->pciname, bus); diff --git a/bcmdhd.1.363.59.144.x.cn/dhd_sdio.c b/bcmdhd.1.363.59.144.x.cn/dhd_sdio.c index b9b3512..45d90d5 100644 --- a/bcmdhd.1.363.59.144.x.cn/dhd_sdio.c +++ b/bcmdhd.1.363.59.144.x.cn/dhd_sdio.c @@ -3215,6 +3215,7 @@ dhd_bus_rxctl(struct dhd_bus *bus, uchar *msg, uint msglen) { int timeleft; uint rxlen = 0; + static uint cnt = 0; DHD_TRACE(("%s: Enter\n", __FUNCTION__)); @@ -3222,7 +3223,7 @@ dhd_bus_rxctl(struct dhd_bus *bus, uchar *msg, uint msglen) return -EIO; /* Wait until control frame is available */ - timeleft = dhd_os_ioctl_resp_wait(bus->dhd, &bus->rxlen); + timeleft = dhd_os_ioctl_resp_wait(bus->dhd, &bus->rxlen, false); dhd_os_sdlock(bus->dhd); rxlen = bus->rxlen; @@ -3230,6 +3231,32 @@ dhd_bus_rxctl(struct dhd_bus *bus, uchar *msg, uint msglen) bus->rxlen = 0; dhd_os_sdunlock(bus->dhd); + if (bus->dhd->conf->ctrl_resched > 0 && !rxlen && timeleft == 0) { + cnt++; + if (cnt <= bus->dhd->conf->ctrl_resched) { + uint32 status, retry = 0; + R_SDREG(status, &bus->regs->intstatus, retry); + if ((status & I_HMB_HOST_INT) || PKT_AVAILABLE(bus, status)) { + DHD_ERROR(("%s: reschedule dhd_dpc, cnt=%d, status=0x%x\n", + __FUNCTION__, cnt, status)); + bus->ipend = TRUE; + bus->dpc_sched = TRUE; + dhd_sched_dpc(bus->dhd); + + /* Wait until control frame is available */ + timeleft = dhd_os_ioctl_resp_wait(bus->dhd, &bus->rxlen, true); + + dhd_os_sdlock(bus->dhd); + rxlen = bus->rxlen; + bcopy(bus->rxctl, msg, MIN(msglen, rxlen)); + bus->rxlen = 0; + dhd_os_sdunlock(bus->dhd); + } + } + } else { + cnt = 0; + } + if (rxlen) { DHD_CTL(("%s: resumed on rxctl frame, got %d expected %d\n", __FUNCTION__, rxlen, msglen)); diff --git a/bcmdhd.1.363.59.144.x.cn/include/epivers.h b/bcmdhd.1.363.59.144.x.cn/include/epivers.h index dfa3aff..7fdf891 100644 --- a/bcmdhd.1.363.59.144.x.cn/include/epivers.h +++ b/bcmdhd.1.363.59.144.x.cn/include/epivers.h @@ -46,6 +46,6 @@ #define EPI_VERSION_DEV 1.363.59 /* Driver Version String, ASCII, 32 chars max */ -#define EPI_VERSION_STR "1.363.59.144.10 (r)" +#define EPI_VERSION_STR "1.363.59.144.11 (r)" #endif /* _epivers_h_ */ diff --git a/bcmdhd.1.579.77.41.1.cn/Makefile b/bcmdhd.1.579.77.41.1.cn/Makefile index 5788bb3..0e7e33d 100644 --- a/bcmdhd.1.579.77.41.1.cn/Makefile +++ b/bcmdhd.1.579.77.41.1.cn/Makefile @@ -20,8 +20,7 @@ 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 -DWL_EXT_IAPSTA \ -DENABLE_INSMOD_NO_FW_LOAD \ -I$(src) -I$(src)/include @@ -34,20 +33,9 @@ DHDOFILES = aiutils.o siutils.o sbutils.o bcmutils.o bcmwifi_channels.o \ ifneq ($(CONFIG_BCMDHD_SDIO),) DHDCFLAGS += \ -DBCMSDIO -DMMC_SDIO_ABORT -DBCMLXSDMMC -DUSE_SDIOFIFO_IOVAR \ - -DBDC -DDHD_USE_IDLECOUNT -DBCMSDIOH_TXGLOM \ + -DBDC -DDHD_USE_IDLECOUNT -DBCMSDIOH_TXGLOM -DBCMSDIOH_TXGLOM_EXT \ -DCUSTOM_SDIO_F2_BLKSIZE=256 -ifeq ($(CONFIG_VTS_SUPPORT),y) -DHDCFLAGS += \ - -DGSCAN_SUPPORT -DRTT_SUPPORT -DCUSTOM_FORCE_NODFS_FLAG \ - -DLINKSTAT_SUPPORT -DDEBUGABILITY -DDBG_PKT_MON -DKEEP_ALIVE -DPKT_FILTER_SUPPORT \ - -DAPF -DNDO_CONFIG_SUPPORT -DRSSI_MONITOR_SUPPORT -DDHDTCPACK_SUPPRESS -DDHD_WAKE_STATUS \ - -DCUSTOM_COUNTRY_CODE -DDHD_FW_COREDUMP -DDHD_USE_STATIC_MEMDUMP - -DHDOFILES += dhd_debug_linux.o dhd_debug.o bcmxtlv.o \ - dhd_rtt.o bcm_app_utils.o -endif - DHDOFILES += bcmsdh.o bcmsdh_linux.o bcmsdh_sdmmc.o bcmsdh_sdmmc_linux.o \ dhd_sdio.o dhd_cdc.o dhd_wlfc.o @@ -74,12 +62,28 @@ ifneq ($(CONFIG_BCMDHD_PCIE),) DHDCFLAGS += \ -DPCIE_FULL_DONGLE -DBCMPCIE -DCUSTOM_DPC_PRIO_SETTING=-1 DHDCFLAGS += -DDHD_PCIE_BAR1_WIN_BASE_FIX=0x200000 +ifneq ($(CONFIG_PCI_MSI),) DHDCFLAGS += -DDHD_USE_MSI +endif +ifeq ($(CONFIG_DHD_USE_STATIC_BUF),y) +DHDCFLAGS += -DDHD_USE_STATIC_CTRLBUF +endif DHDOFILES += dhd_pcie.o dhd_pcie_linux.o pcie_core.o dhd_flowring.o \ dhd_msgbuf.o endif +ifeq ($(CONFIG_VTS_SUPPORT),y) +DHDCFLAGS += \ + -DGSCAN_SUPPORT -DRTT_SUPPORT -DCUSTOM_FORCE_NODFS_FLAG \ + -DLINKSTAT_SUPPORT -DDEBUGABILITY -DDBG_PKT_MON -DKEEP_ALIVE -DPKT_FILTER_SUPPORT \ + -DAPF -DNDO_CONFIG_SUPPORT -DRSSI_MONITOR_SUPPORT -DDHDTCPACK_SUPPRESS -DDHD_WAKE_STATUS \ + -DCUSTOM_COUNTRY_CODE -DDHD_FW_COREDUMP -DEXPLICIT_DISCIF_CLEANUP + +DHDOFILES += dhd_debug_linux.o dhd_debug.o bcmxtlv.o \ + dhd_rtt.o bcm_app_utils.o +endif + obj-$(CONFIG_BCMDHD) += dhd.o dhd-objs += $(DHDOFILES) @@ -96,7 +100,8 @@ endif ifeq ($(CONFIG_DHD_USE_STATIC_BUF),y) #obj-m += dhd_static_buf.o -DHDCFLAGS += -DSTATIC_WL_PRIV_STRUCT -DENHANCED_STATIC_BUF -DCONFIG_DHD_USE_STATIC_BUF +DHDCFLAGS += -DSTATIC_WL_PRIV_STRUCT -DENHANCED_STATIC_BUF +DHDCFLAGS += -DDHD_USE_STATIC_MEMDUMP -DCONFIG_DHD_USE_STATIC_BUF endif ifneq ($(CONFIG_WIRELESS_EXT),) diff --git a/bcmdhd.1.579.77.41.1.cn/bcmsdh_sdmmc.c b/bcmdhd.1.579.77.41.1.cn/bcmsdh_sdmmc.c index d98411f..0921a6c 100644 --- a/bcmdhd.1.579.77.41.1.cn/bcmsdh_sdmmc.c +++ b/bcmdhd.1.579.77.41.1.cn/bcmsdh_sdmmc.c @@ -57,18 +57,6 @@ mmc_host_clk_release(struct mmc_host *host) #include #else #include -static inline void mmc_host_clk_hold(struct mmc_host *host) -{ -} - -static inline void mmc_host_clk_release(struct mmc_host *host) -{ -} - -static inline unsigned int mmc_host_clk_rate(struct mmc_host *host) -{ - return host->ios.clock; -} #endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION(3, 0, 0)) */ #include #include diff --git a/bcmdhd.1.579.77.41.1.cn/dhd.h b/bcmdhd.1.579.77.41.1.cn/dhd.h index 0c46434..f1a3885 100644 --- a/bcmdhd.1.579.77.41.1.cn/dhd.h +++ b/bcmdhd.1.579.77.41.1.cn/dhd.h @@ -1494,7 +1494,7 @@ extern void dhd_os_dhdiovar_lock(dhd_pub_t *pub); extern void dhd_os_dhdiovar_unlock(dhd_pub_t *pub); extern int dhd_os_proto_block(dhd_pub_t * pub); extern int dhd_os_proto_unblock(dhd_pub_t * pub); -extern int dhd_os_ioctl_resp_wait(dhd_pub_t * pub, uint * condition); +extern int dhd_os_ioctl_resp_wait(dhd_pub_t * pub, uint * condition, bool resched); extern int dhd_os_ioctl_resp_wake(dhd_pub_t * pub); extern unsigned int dhd_os_get_ioctl_resp_timeout(void); extern void dhd_os_set_ioctl_resp_timeout(unsigned int timeout_msec); diff --git a/bcmdhd.1.579.77.41.1.cn/dhd_config.c b/bcmdhd.1.579.77.41.1.cn/dhd_config.c index 700573f..e489c57 100644 --- a/bcmdhd.1.579.77.41.1.cn/dhd_config.c +++ b/bcmdhd.1.579.77.41.1.cn/dhd_config.c @@ -59,12 +59,13 @@ uint config_msg_level = CONFIG_ERROR_LEVEL; #define CONFIG_BCM43341B0 "config_43341b0.txt" #define CONFIG_BCM43241B4 "config_43241b4.txt" #define CONFIG_BCM4339A0 "config_4339a0.txt" +#define CONFIG_BCM43454C0 "config_43454c0.txt" #define CONFIG_BCM43455C0 "config_43455c0.txt" #define CONFIG_BCM43456C5 "config_43456c5.txt" #define CONFIG_BCM4354A1 "config_4354a1.txt" #endif #define CONFIG_BCM4356A2 "config_4356a2.txt" -#define CONFIG_BCM4358A3 "config_4358.txt" +#define CONFIG_BCM4358A3 "config_4358a3.txt" #define CONFIG_BCM4359B1 "config_4359b1.txt" #define CONFIG_BCM4359C0 "config_4359c0.txt" #endif @@ -80,7 +81,7 @@ uint config_msg_level = CONFIG_ERROR_LEVEL; #define FW_BCM43438A0 "fw_bcm43438a0" #define FW_BCM43438A1 "fw_bcm43438a1" #define FW_BCM43436B0 "fw_bcm43436b0" -#define FW_BCM43012B0 "fw_bcm43012b0" +#define FW_BCM43013B0 "fw_bcm43013b0" #define FW_BCM43341B1 "fw_bcm43341b0_ag" #define FW_BCM43241B4 "fw_bcm43241b4_ag" #define FW_BCM4339A0 "fw_bcm4339a0_ag" @@ -88,11 +89,11 @@ uint config_msg_level = CONFIG_ERROR_LEVEL; #define FW_BCM43456C5 "fw_bcm43456c5_ag" #define FW_BCM4354A1 "fw_bcm4354a1_ag" #define FW_BCM4356A2 "fw_bcm4356a2_ag" -#define FW_BCM4358A3 "fw_bcm4358_ag" +#define FW_BCM4358A3 "fw_bcm4358a3_ag" #define FW_BCM4359B1 "fw_bcm4359b1_ag" #define FW_BCM4359C0 "fw_bcm4359c0_ag" -#define CLM_BCM43012B0 "clm_bcm43012b0" +#define CLM_BCM43013B0 "clm_bcm43013b0" #endif #ifdef BCMPCIE #define FW_BCM4356A2 "fw_bcm4356a2_pcie_ag" @@ -468,8 +469,8 @@ dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path) strcpy(&fw_path[i+1], FW_BCM43436B0); break; case BCM43012_CHIP_ID: - if (chiprev == BCM43012B0_CHIP_REV) - strcpy(&fw_path[i+1], FW_BCM43012B0); + if (chiprev == BCM43013B0_CHIP_REV) + strcpy(&fw_path[i+1], FW_BCM43013B0); break; case BCM4334_CHIP_ID: if (chiprev == BCM4334B1_CHIP_REV) @@ -492,14 +493,11 @@ dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path) if (chiprev == BCM4339A0_CHIP_REV) strcpy(&fw_path[i+1], FW_BCM4339A0); break; - case BCM43454_CHIP_ID: - if (chiprev == BCM43455C0_CHIP_REV) - strcpy(&fw_path[i+1], FW_BCM43455C0); - break; case BCM4345_CHIP_ID: + case BCM43454_CHIP_ID: if (chiprev == BCM43455C0_CHIP_REV) strcpy(&fw_path[i+1], FW_BCM43455C0); - else if (chiprev == BCM43455C5_CHIP_REV) + else if (chiprev == BCM43456C5_CHIP_REV) strcpy(&fw_path[i+1], FW_BCM43456C5); break; case BCM4354_CHIP_ID: @@ -566,8 +564,8 @@ dhd_conf_set_clm_name_by_chip(dhd_pub_t *dhd, char *clm_path) switch (chip) { #ifdef BCMSDIO case BCM43012_CHIP_ID: - if (chiprev == BCM43012B0_CHIP_REV) - strcpy(&clm_path[i+1], CLM_BCM43012B0); + if (chiprev == BCM43013B0_CHIP_REV) + strcpy(&clm_path[i+1], CLM_BCM43013B0); break; #endif default: @@ -702,11 +700,14 @@ dhd_conf_set_conf_name_by_chip(dhd_pub_t *dhd, char *conf_path) if (chiprev == BCM4335A0_CHIP_REV) strcpy(&conf_path[i+1], CONFIG_BCM4339A0); break; - case BCM4345_CHIP_ID: case BCM43454_CHIP_ID: + if (chiprev == BCM43455C0_CHIP_REV) + strcpy(&conf_path[i+1], CONFIG_BCM43454C0); + break; + case BCM4345_CHIP_ID: if (chiprev == BCM43455C0_CHIP_REV) strcpy(&conf_path[i+1], CONFIG_BCM43455C0); - else if (chiprev == BCM43455C5_CHIP_REV) + else if (chiprev == BCM43456C5_CHIP_REV) strcpy(&conf_path[i+1], CONFIG_BCM43456C5); break; case BCM4339_CHIP_ID: @@ -1136,7 +1137,7 @@ void dhd_conf_add_pkt_filter(dhd_pub_t *dhd) { int i, j; - char str[12]; + char str[16]; #define MACS "%02x%02x%02x%02x%02x%02x" /* @@ -1157,17 +1158,17 @@ dhd_conf_add_pkt_filter(dhd_pub_t *dhd) } dhd->pktfilter_count += i; - for(i=0; iconf->magic_pkt_filter_add.count; i++) { - strcat(&dhd->conf->magic_pkt_filter_add.filter[i][0], " 0x"); - strcat(&dhd->conf->magic_pkt_filter_add.filter[i][0], "FFFFFFFFFFFF"); + if (dhd->conf->magic_pkt_filter_add) { + strcat(dhd->conf->magic_pkt_filter_add, " 0x"); + strcat(dhd->conf->magic_pkt_filter_add, "FFFFFFFFFFFF"); for (j=0; j<16; j++) - strcat(&dhd->conf->magic_pkt_filter_add.filter[i][0], "FFFFFFFFFFFF"); - strcat(&dhd->conf->magic_pkt_filter_add.filter[i][0], " 0x"); - strcat(&dhd->conf->magic_pkt_filter_add.filter[i][0], "FFFFFFFFFFFF"); + strcat(dhd->conf->magic_pkt_filter_add, "FFFFFFFFFFFF"); + strcat(dhd->conf->magic_pkt_filter_add, " 0x"); + strcat(dhd->conf->magic_pkt_filter_add, "FFFFFFFFFFFF"); sprintf(str, MACS, MAC2STRDBG(dhd->mac.octet)); for (j=0; j<16; j++) - strcat(&dhd->conf->magic_pkt_filter_add.filter[i][0], str); - dhd->pktfilter[i+dhd->pktfilter_count] = dhd->conf->magic_pkt_filter_add.filter[i]; + strncat(dhd->conf->magic_pkt_filter_add, str, 12); + dhd->pktfilter[dhd->pktfilter_count] = dhd->conf->magic_pkt_filter_add; dhd->pktfilter_count += 1; } } @@ -1815,16 +1816,12 @@ dhd_conf_read_pkt_filter(dhd_pub_t *dhd, char *full_param, uint len_param) printf("\n"); } else if (!strncmp("magic_pkt_filter_add=", full_param, len_param)) { - pick_tmp = data; - pch = bcmstrtok(&pick_tmp, ",.-", 0); - i=0; - while (pch != NULL && imagic_pkt_filter_add.filter[i][0], pch); - printf("%s: magic_pkt_filter_add[%d][] = %s\n", __FUNCTION__, i, &conf->magic_pkt_filter_add.filter[i][0]); - pch = bcmstrtok(&pick_tmp, ",.-", 0); - i++; + if (!(conf->magic_pkt_filter_add = kmalloc(MAGIC_PKT_FILTER_LEN, GFP_KERNEL))) { + CONFIG_ERROR(("%s: kmalloc failed\n", __FUNCTION__)); + } else { + strcpy(conf->magic_pkt_filter_add, data); + printf("%s: magic_pkt_filter_add = %s\n", __FUNCTION__, conf->magic_pkt_filter_add); } - conf->magic_pkt_filter_add.count = i; } else return false; @@ -2007,13 +2004,6 @@ dhd_conf_read_sdio_params(dhd_pub_t *dhd, char *full_param, uint len_param) conf->bus_rxglom = TRUE; printf("%s: bus:rxglom = %d\n", __FUNCTION__, conf->bus_rxglom); } - else if (!strncmp("dhd_poll=", full_param, len_param)) { - if (!strncmp(data, "0", 1)) - conf->dhd_poll = 0; - else - conf->dhd_poll = 1; - printf("%s: dhd_poll = %d\n", __FUNCTION__, conf->dhd_poll); - } else if (!strncmp("deferred_tx_len=", full_param, len_param)) { conf->deferred_tx_len = (int)simple_strtol(data, NULL, 10); printf("%s: deferred_tx_len = %d\n", __FUNCTION__, conf->deferred_tx_len); @@ -2048,6 +2038,27 @@ dhd_conf_read_sdio_params(dhd_pub_t *dhd, char *full_param, uint len_param) } #endif +#ifdef BCMPCIE +bool +dhd_conf_read_pcie_params(dhd_pub_t *dhd, char *full_param, uint len_param) +{ + struct dhd_conf *conf = dhd->conf; + char *data = full_param+len_param; + + if (!strncmp("bus:deepsleep_disable=", full_param, len_param)) { + if (!strncmp(data, "0", 1)) + conf->bus_deepsleep_disable = 0; + else + conf->bus_deepsleep_disable = 1; + printf("%s: bus:deepsleep_disable = %d\n", __FUNCTION__, conf->bus_deepsleep_disable); + } + else + return false; + + return true; +} +#endif + bool dhd_conf_read_pm_params(dhd_pub_t *dhd, char *full_param, uint len_param) { @@ -2103,7 +2114,18 @@ dhd_conf_read_others(dhd_pub_t *dhd, char *full_param, uint len_param) char *pch, *pick_tmp; int i; - if (!strncmp("band=", full_param, len_param)) { + if (!strncmp("dhd_poll=", full_param, len_param)) { + if (!strncmp(data, "0", 1)) + conf->dhd_poll = 0; + else + conf->dhd_poll = 1; + printf("%s: dhd_poll = %d\n", __FUNCTION__, conf->dhd_poll); + } + else if (!strncmp("dhd_watchdog_ms=", full_param, len_param)) { + dhd_watchdog_ms = (int)simple_strtol(data, NULL, 10); + printf("%s: dhd_watchdog_ms = %d\n", __FUNCTION__, dhd_watchdog_ms); + } + else if (!strncmp("band=", full_param, len_param)) { /* Process band: * band=a for 5GHz only and band=b for 2.4GHz only */ @@ -2242,6 +2264,14 @@ dhd_conf_read_others(dhd_pub_t *dhd, char *full_param, uint len_param) conf->tsq = (int)simple_strtol(data, NULL, 10); printf("%s: tsq = %d\n", __FUNCTION__, conf->tsq); } + else if (!strncmp("ctrl_resched=", full_param, len_param)) { + conf->ctrl_resched = (int)simple_strtol(data, NULL, 10); + printf("%s: ctrl_resched = %d\n", __FUNCTION__, conf->ctrl_resched); + } + else if (!strncmp("dhd_ioctl_timeout_msec=", full_param, len_param)) { + conf->dhd_ioctl_timeout_msec = (int)simple_strtol(data, NULL, 10); + printf("%s: dhd_ioctl_timeout_msec = %d\n", __FUNCTION__, conf->dhd_ioctl_timeout_msec); + } else return false; @@ -2340,6 +2370,10 @@ dhd_conf_read_config(dhd_pub_t *dhd, char *conf_path) else if (dhd_conf_read_sdio_params(dhd, pick, len_param)) continue; #endif /* BCMSDIO */ +#ifdef BCMPCIE + else if (dhd_conf_read_pcie_params(dhd, pick, len_param)) + continue; +#endif /* BCMPCIE */ else if (dhd_conf_read_pm_params(dhd, pick, len_param)) continue; else if (dhd_conf_read_others(dhd, pick, len_param)) @@ -2435,6 +2469,7 @@ int dhd_conf_preinit(dhd_pub_t *dhd) { struct dhd_conf *conf = dhd->conf; +// int i; CONFIG_TRACE(("%s: Enter\n", __FUNCTION__)); @@ -2443,6 +2478,8 @@ dhd_conf_preinit(dhd_pub_t *dhd) dhd_conf_free_mac_list(&conf->nv_by_mac); dhd_conf_free_chip_nv_path_list(&conf->nv_by_chip); #endif + if (conf->magic_pkt_filter_add) + kfree(conf->magic_pkt_filter_add); memset(&conf->country_list, 0, sizeof(conf_country_list_t)); conf->band = -1; conf->mimo_bw_cap = -1; @@ -2499,7 +2536,6 @@ dhd_conf_preinit(dhd_pub_t *dhd) #ifdef PKT_FILTER_SUPPORT memset(&conf->pkt_filter_add, 0, sizeof(conf_pkt_filter_add_t)); memset(&conf->pkt_filter_del, 0, sizeof(conf_pkt_filter_del_t)); - memset(&conf->magic_pkt_filter_add, 0, sizeof(conf_pkt_filter_del_t)); #endif conf->srl = -1; conf->lrl = -1; @@ -2508,6 +2544,7 @@ dhd_conf_preinit(dhd_pub_t *dhd) conf->txbf = -1; conf->lpc = -1; conf->disable_proptx = -1; + conf->dhd_poll = -1; #ifdef BCMSDIO conf->bus_txglom = -1; conf->use_rxchain = 0; @@ -2515,7 +2552,6 @@ dhd_conf_preinit(dhd_pub_t *dhd) conf->txglom_ext = FALSE; conf->tx_max_offset = 0; conf->txglomsize = SDPCM_DEFGLOM_SIZE; - conf->dhd_poll = -1; conf->txctl_tmo_fix = 5; conf->tx_in_rx = TRUE; conf->txglom_mode = SDPCM_TXGLOM_MDESC; @@ -2524,6 +2560,9 @@ dhd_conf_preinit(dhd_pub_t *dhd) conf->txinrx_thres = -1; conf->sd_f2_blocksize = 0; conf->oob_enabled_later = FALSE; +#endif +#ifdef BCMPCIE + conf->bus_deepsleep_disable = 1; #endif conf->ampdu_ba_wsize = 0; conf->ampdu_hostreorder = -1; @@ -2553,6 +2592,8 @@ dhd_conf_preinit(dhd_pub_t *dhd) conf->rsdb_mode = -2; conf->vhtmode = -1; conf->autocountry = -1; + conf->ctrl_resched = 2; + conf->dhd_ioctl_timeout_msec = 0; #ifdef IAPSTA_PREINIT memset(conf->iapsta_init, 0, sizeof(conf->iapsta_init)); memset(conf->iapsta_config, 0, sizeof(conf->iapsta_config)); @@ -2565,7 +2606,9 @@ dhd_conf_preinit(dhd_pub_t *dhd) conf->chip == BCM4371_CHIP_ID || conf->chip == BCM43569_CHIP_ID || conf->chip == BCM4359_CHIP_ID) { #ifdef DHDTCPACK_SUPPRESS +#ifdef BCMSDIO conf->tcpack_sup_mode = TCPACK_SUP_REPLACE; +#endif #endif dhd_rxbound = 128; dhd_txbound = 64; @@ -2620,6 +2663,8 @@ dhd_conf_reset(dhd_pub_t *dhd) dhd_conf_free_mac_list(&dhd->conf->nv_by_mac); dhd_conf_free_chip_nv_path_list(&dhd->conf->nv_by_chip); #endif + if (dhd->conf->magic_pkt_filter_add) + kfree(dhd->conf->magic_pkt_filter_add); memset(dhd->conf, 0, sizeof(dhd_conf_t)); return 0; } @@ -2663,6 +2708,8 @@ dhd_conf_detach(dhd_pub_t *dhd) dhd_conf_free_mac_list(&dhd->conf->nv_by_mac); dhd_conf_free_chip_nv_path_list(&dhd->conf->nv_by_chip); #endif + if (dhd->conf->magic_pkt_filter_add) + kfree(dhd->conf->magic_pkt_filter_add); MFREE(dhd->osh, dhd->conf, sizeof(dhd_conf_t)); } dhd->conf = NULL; diff --git a/bcmdhd.1.579.77.41.1.cn/dhd_config.h b/bcmdhd.1.579.77.41.1.cn/dhd_config.h index 5fdd538..0529ccc 100644 --- a/bcmdhd.1.579.77.41.1.cn/dhd_config.h +++ b/bcmdhd.1.579.77.41.1.cn/dhd_config.h @@ -23,7 +23,7 @@ extern uint dhd_slpauto; #define BCM43430A0_CHIP_REV 0 #define BCM43430A1_CHIP_REV 1 #define BCM43430A2_CHIP_REV 2 -#define BCM43012B0_CHIP_REV 1 +#define BCM43013B0_CHIP_REV 1 #define BCM4330B2_CHIP_REV 4 #define BCM4334B1_CHIP_REV 3 #define BCM43341B0_CHIP_REV 2 @@ -31,7 +31,7 @@ extern uint dhd_slpauto; #define BCM4335A0_CHIP_REV 2 #define BCM4339A0_CHIP_REV 1 #define BCM43455C0_CHIP_REV 6 -#define BCM43455C5_CHIP_REV 9 +#define BCM43456C5_CHIP_REV 9 #define BCM4354A1_CHIP_REV 1 #define BCM4359B1_CHIP_REV 5 #define BCM4359C0_CHIP_REV 9 @@ -82,6 +82,7 @@ typedef struct wmes_param { #ifdef PKT_FILTER_SUPPORT #define DHD_CONF_FILTER_MAX 8 #define PKT_FILTER_LEN 300 +#define MAGIC_PKT_FILTER_LEN 450 typedef struct conf_pkt_filter_add { uint32 count; char filter[DHD_CONF_FILTER_MAX][PKT_FILTER_LEN]; @@ -114,7 +115,7 @@ typedef struct dhd_conf { wl_channel_list_t channels; uint roam_off; uint roam_off_suspend; - int roam_trigger[2]; + int roam_trigger[2]; int roam_scan_period[2]; int roam_delta[2]; int fullroamperiod; @@ -127,7 +128,7 @@ typedef struct dhd_conf { #ifdef PKT_FILTER_SUPPORT conf_pkt_filter_add_t pkt_filter_add; conf_pkt_filter_del_t pkt_filter_del; - conf_pkt_filter_add_t magic_pkt_filter_add; + char *magic_pkt_filter_add; #endif int srl; int lrl; @@ -136,6 +137,7 @@ typedef struct dhd_conf { int txbf; int lpc; int disable_proptx; + int dhd_poll; #ifdef BCMSDIO int bus_txglom; int use_rxchain; @@ -148,7 +150,6 @@ typedef struct dhd_conf { */ int tx_max_offset; uint txglomsize; - int dhd_poll; int txctl_tmo_fix; bool tx_in_rx; bool txglom_mode; @@ -162,6 +163,9 @@ typedef struct dhd_conf { int dhd_txminmax; // -1=DATABUFCNT(bus) uint sd_f2_blocksize; bool oob_enabled_later; +#endif +#ifdef BCMPCIE + int bus_deepsleep_disable; #endif int ampdu_ba_wsize; int ampdu_hostreorder; @@ -200,6 +204,8 @@ typedef struct dhd_conf { char iapsta_enable[50]; #endif int autocountry; + int ctrl_resched; + int dhd_ioctl_timeout_msec; int tsq; } dhd_conf_t; diff --git a/bcmdhd.1.579.77.41.1.cn/dhd_gpio.c b/bcmdhd.1.579.77.41.1.cn/dhd_gpio.c index 78537c8..0f01038 100644 --- a/bcmdhd.1.579.77.41.1.cn/dhd_gpio.c +++ b/bcmdhd.1.579.77.41.1.cn/dhd_gpio.c @@ -15,6 +15,9 @@ #include #endif /* defined(BUS_POWER_RESTORE) && defined(BCMSDIO) */ +#ifdef CONFIG_DHD_USE_STATIC_BUF +extern void *bcm_wlan_prealloc(int section, unsigned long size); +#endif /* CONFIG_DHD_USE_STATIC_BUF */ static int gpio_wl_reg_on = -1; // WL_REG_ON is input pin of WLAN module #ifdef CUSTOMER_OOB @@ -189,33 +192,21 @@ static int dhd_wlan_get_mac_addr(unsigned char *buf) return err; } -#ifdef CONFIG_DHD_USE_STATIC_BUF -extern void *bcmdhd_mem_prealloc(int section, unsigned long size); -void* bcm_wlan_prealloc(int section, unsigned long size) -{ - void *alloc_ptr = NULL; - alloc_ptr = bcmdhd_mem_prealloc(section, size); - if (alloc_ptr) { - printf("success alloc section %d, size %ld\n", section, size); - if (size != 0L) - bzero(alloc_ptr, size); - return alloc_ptr; - } - printf("can't alloc section %d\n", section); - return NULL; -} -#endif static struct cntry_locales_custom brcm_wlan_translate_custom_table[] = { /* Table should be filled out based on custom platform regulatory requirement */ +#ifdef EXAMPLE_TABLE {"", "XT", 49}, /* Universal if Country code is unknown or empty */ {"US", "US", 0}, +#endif /* EXMAPLE_TABLE */ }; #ifdef CUSTOM_FORCE_NODFS_FLAG struct cntry_locales_custom brcm_wlan_translate_nodfs_table[] = { +#ifdef EXAMPLE_TABLE {"", "XT", 50}, /* Universal if Country code is unknown or empty */ {"US", "US", 0}, +#endif /* EXMAPLE_TABLE */ }; #endif diff --git a/bcmdhd.1.579.77.41.1.cn/dhd_linux.c b/bcmdhd.1.579.77.41.1.cn/dhd_linux.c index 3bf901c..65af5f9 100644 --- a/bcmdhd.1.579.77.41.1.cn/dhd_linux.c +++ b/bcmdhd.1.579.77.41.1.cn/dhd_linux.c @@ -11678,6 +11678,9 @@ dhd_preinit_ioctls(dhd_pub_t *dhd) // terence 20151210: set bus:txglom after dhd_txglom_enable since it's possible changed in dhd_conf_set_txglom_params dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "bus:txglom", dhd->conf->bus_txglom, 0, FALSE); #endif /* defined(BCMSDIO) */ +#if defined(BCMPCIE) + dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "bus:deepsleep_disable", dhd->conf->bus_deepsleep_disable, 0, FALSE); +#endif /* defined(BCMPCIE) */ #if defined(BCMSDIO) #ifdef PROP_TXSTATUS @@ -13215,10 +13218,15 @@ dhd_os_set_ioctl_resp_timeout(unsigned int timeout_msec) } int -dhd_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition) +dhd_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition, bool resched) { dhd_info_t * dhd = (dhd_info_t *)(pub->info); - int timeout; + int timeout, timeout_tmp = dhd_ioctl_timeout_msec; + + if (!resched && pub->conf->ctrl_resched>0 && pub->conf->dhd_ioctl_timeout_msec>0) { + timeout_tmp = dhd_ioctl_timeout_msec; + dhd_ioctl_timeout_msec = pub->conf->dhd_ioctl_timeout_msec; + } /* Convert timeout in millsecond to jiffies */ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) @@ -13231,6 +13239,10 @@ dhd_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition) timeout = wait_event_timeout(dhd->ioctl_resp_wait, (*condition), timeout); + if (!resched && pub->conf->ctrl_resched>0 && pub->conf->dhd_ioctl_timeout_msec>0) { + dhd_ioctl_timeout_msec = timeout_tmp; + } + DHD_PERIM_LOCK(pub); return timeout; @@ -14124,6 +14136,9 @@ dhd_dev_get_feature_set(struct net_device *dev) if (dhd_is_pno_supported(dhd)) { feature_set |= WIFI_FEATURE_PNO; #ifdef GSCAN_SUPPORT + /* terence 20171115: remove to get GTS PASS + * com.google.android.gts.wifi.WifiHostTest#testWifiScannerBatchTimestamp + */ // feature_set |= WIFI_FEATURE_GSCAN; // feature_set |= WIFI_FEATURE_HAL_EPNO; #endif /* GSCAN_SUPPORT */ @@ -19135,6 +19150,7 @@ static void dhd_sysfs_exit(dhd_info_t *dhd) DHD_ERROR(("%s(): dhd is NULL \r\n", __FUNCTION__)); return; } + if (&dhd->dhd_kobj != NULL) kobject_put(&dhd->dhd_kobj); } diff --git a/bcmdhd.1.579.77.41.1.cn/dhd_msgbuf.c b/bcmdhd.1.579.77.41.1.cn/dhd_msgbuf.c index e602d24..455f125 100644 --- a/bcmdhd.1.579.77.41.1.cn/dhd_msgbuf.c +++ b/bcmdhd.1.579.77.41.1.cn/dhd_msgbuf.c @@ -52,6 +52,7 @@ #include #include #include +#include #ifdef DHD_TIMESYNC #include #endif /* DHD_TIMESYNC */ @@ -6013,6 +6014,7 @@ dhd_msgbuf_wait_ioctl_cmplt(dhd_pub_t *dhd, uint32 len, void *buf) int timeleft; unsigned long flags; int ret = 0; + static uint cnt = 0; DHD_TRACE(("%s: Enter\n", __FUNCTION__)); @@ -6021,7 +6023,7 @@ dhd_msgbuf_wait_ioctl_cmplt(dhd_pub_t *dhd, uint32 len, void *buf) goto out; } - timeleft = dhd_os_ioctl_resp_wait(dhd, (uint *)&prot->ioctl_received); + timeleft = dhd_os_ioctl_resp_wait(dhd, (uint *)&prot->ioctl_received, false); #ifdef DHD_RECOVER_TIMEOUT if (prot->ioctl_received == 0) { @@ -6053,6 +6055,25 @@ dhd_msgbuf_wait_ioctl_cmplt(dhd_pub_t *dhd, uint32 len, void *buf) } #endif /* DHD_RECOVER_TIMEOUT */ + if (dhd->conf->ctrl_resched > 0 && timeleft == 0 && (!dhd_query_bus_erros(dhd))) { + cnt++; + if (cnt <= dhd->conf->ctrl_resched) { + uint32 intstatus = 0, intmask = 0; + intstatus = si_corereg(dhd->bus->sih, dhd->bus->sih->buscoreidx, PCIMailBoxInt, 0, 0); + intmask = si_corereg(dhd->bus->sih, dhd->bus->sih->buscoreidx, PCIMailBoxMask, 0, 0); + if (intstatus) { + DHD_ERROR(("%s: reschedule dhd_dpc, cnt=%d, intstatus=0x%x, intmask=0x%x\n", + __FUNCTION__, cnt, intstatus, intmask)); + dhd->bus->ipend = TRUE; + dhd->bus->dpc_sched = TRUE; + dhd_sched_dpc(dhd); + timeleft = dhd_os_ioctl_resp_wait(dhd, &prot->ioctl_received, true); + } + } + } else { + cnt = 0; + } + if (timeleft == 0 && (!dhd_query_bus_erros(dhd))) { uint32 intstatus; diff --git a/bcmdhd.1.579.77.41.1.cn/dhd_pcie.c b/bcmdhd.1.579.77.41.1.cn/dhd_pcie.c index 77995b5..48e3d19 100644 --- a/bcmdhd.1.579.77.41.1.cn/dhd_pcie.c +++ b/bcmdhd.1.579.77.41.1.cn/dhd_pcie.c @@ -497,7 +497,9 @@ uint32 dhdpcie_bus_intstatus(dhd_bus_t *bus) { uint32 intstatus = 0; +#ifndef DHD_READ_INTSTATUS_IN_DPC uint32 intmask = 0; +#endif /* DHD_READ_INTSTATUS_IN_DPC */ if ((bus->dhd->busstate == DHD_BUS_SUSPEND || bus->d3_suspend_pending) && bus->wait_for_d3_ack) { @@ -521,10 +523,12 @@ dhdpcie_bus_intstatus(dhd_bus_t *bus) /* this is a PCIE core register..not a config register... */ intstatus = si_corereg(bus->sih, bus->sih->buscoreidx, PCIMailBoxInt, 0, 0); +#ifndef DHD_READ_INTSTATUS_IN_DPC /* this is a PCIE core register..not a config register... */ intmask = si_corereg(bus->sih, bus->sih->buscoreidx, PCIMailBoxMask, 0, 0); intstatus &= intmask; +#endif /* DHD_READ_INTSTATUS_IN_DPC */ /* Is device removed. intstatus & intmask read 0xffffffff */ if (intstatus == (uint32)-1) { DHD_ERROR(("%s: Device is removed or Link is down.\n", __FUNCTION__)); @@ -600,6 +604,7 @@ dhdpcie_bus_isr(dhd_bus_t *bus) } } +#ifndef DHD_READ_INTSTATUS_IN_DPC intstatus = dhdpcie_bus_intstatus(bus); /* Check if the interrupt is ours or not */ @@ -627,6 +632,7 @@ dhdpcie_bus_isr(dhd_bus_t *bus) /* Count the interrupt call */ bus->intrcount++; +#endif /* DHD_READ_INTSTATUS_IN_DPC */ bus->ipend = TRUE; @@ -1008,6 +1014,8 @@ dhdpcie_dongle_attach(dhd_bus_t *bus) /* Set the poll and/or interrupt flags */ bus->intr = (bool)dhd_intr; + if ((bus->poll = (bool)dhd_poll)) + bus->pollrate = 1; bus->wait_for_d3_ack = 1; #ifdef PCIE_OOB @@ -1530,6 +1538,14 @@ bool dhd_bus_watchdog(dhd_pub_t *dhd) } } +#ifdef DHD_READ_INTSTATUS_IN_DPC + if (bus->poll) { + bus->ipend = TRUE; + bus->dpc_sched = TRUE; + dhd_sched_dpc(bus->dhd); /* queue DPC now!! */ + } +#endif /* DHD_READ_INTSTATUS_IN_DPC */ + #if defined(PCIE_OOB) || defined(PCIE_INB_DW) /* If haven't communicated with device for a while, deassert the Device_Wake GPIO */ if (dhd_doorbell_timeout != 0 && dhd->busstate == DHD_BUS_DATA && @@ -1639,6 +1655,17 @@ dhd_set_path_params(struct dhd_bus *bus) } +void +dhd_set_bus_params(struct dhd_bus *bus) +{ + if (bus->dhd->conf->dhd_poll >= 0) { + bus->poll = bus->dhd->conf->dhd_poll; + if (!bus->pollrate) + bus->pollrate = 1; + printf("%s: set polling mode %d\n", __FUNCTION__, bus->dhd->conf->dhd_poll); + } +} + static int dhdpcie_download_firmware(struct dhd_bus *bus, osl_t *osh) { @@ -1680,6 +1707,7 @@ dhdpcie_download_firmware(struct dhd_bus *bus, osl_t *osh) DHD_OS_WAKE_LOCK(bus->dhd); dhd_set_path_params(bus); + dhd_set_bus_params(bus); ret = _dhdpcie_download_firmware(bus); @@ -6066,10 +6094,24 @@ dhd_bus_dpc(struct dhd_bus *bus) DHD_BUS_BUSY_SET_IN_DPC(bus->dhd); DHD_GENERAL_UNLOCK(bus->dhd, flags); +#ifdef DHD_READ_INTSTATUS_IN_DPC + if (bus->ipend) { + bus->ipend = FALSE; + bus->intstatus = dhdpcie_bus_intstatus(bus); + /* Check if the interrupt is ours or not */ + if (bus->intstatus == 0) { + goto INTR_ON; + } + bus->intrcount++; + } +#endif /* DHD_READ_INTSTATUS_IN_DPC */ resched = dhdpcie_bus_process_mailbox_intr(bus, bus->intstatus); if (!resched) { bus->intstatus = 0; +#ifdef DHD_READ_INTSTATUS_IN_DPC +INTR_ON: +#endif /* DHD_READ_INTSTATUS_IN_DPC */ bus->dpc_intr_enable_count++; dhdpcie_bus_intr_enable(bus); /* Enable back interrupt using Intmask!! */ } diff --git a/bcmdhd.1.579.77.41.1.cn/dhd_pcie.h b/bcmdhd.1.579.77.41.1.cn/dhd_pcie.h index eb8de62..92b07c6 100644 --- a/bcmdhd.1.579.77.41.1.cn/dhd_pcie.h +++ b/bcmdhd.1.579.77.41.1.cn/dhd_pcie.h @@ -259,6 +259,7 @@ typedef struct dhd_bus { struct pktq txq; /* Queue length used for flow-control */ bool intr; /* Use interrupts */ + bool poll; /* Use polling */ bool ipend; /* Device interrupt is pending */ bool intdis; /* Interrupts disabled by isr */ uint intrcount; /* Count of device interrupt callbacks */ diff --git a/bcmdhd.1.579.77.41.1.cn/dhd_pcie_linux.c b/bcmdhd.1.579.77.41.1.cn/dhd_pcie_linux.c index 51664a7..5c9561a 100644 --- a/bcmdhd.1.579.77.41.1.cn/dhd_pcie_linux.c +++ b/bcmdhd.1.579.77.41.1.cn/dhd_pcie_linux.c @@ -1029,10 +1029,22 @@ dhdpcie_request_irq(dhdpcie_info_t *dhdpcie_info) if (!bus->irq_registered) { snprintf(dhdpcie_info->pciname, sizeof(dhdpcie_info->pciname), "dhdpcie:%s", pci_name(pdev)); +#ifdef DHD_USE_MSI + printf("%s: MSI enabled\n", __FUNCTION__); + err = pci_enable_msi(pdev); + if (err < 0) { + DHD_ERROR(("%s: pci_enable_msi() failed, %d, fall back to INTx\n", __FUNCTION__, err)); + } +#else + printf("%s: MSI not enabled\n", __FUNCTION__); +#endif /* DHD_USE_MSI */ err = request_irq(pdev->irq, dhdpcie_isr, IRQF_SHARED, dhdpcie_info->pciname, bus); if (err) { DHD_ERROR(("%s: request_irq() failed\n", __FUNCTION__)); +#ifdef DHD_USE_MSI + pci_disable_msi(pdev); +#endif /* DHD_USE_MSI */ return -1; } else { bus->irq_registered = TRUE; @@ -1497,6 +1509,9 @@ dhdpcie_free_irq(dhd_bus_t *bus) if (bus->irq_registered) { free_irq(pdev->irq, bus); bus->irq_registered = FALSE; +#ifdef DHD_USE_MSI + pci_disable_msi(pdev); +#endif /* DHD_USE_MSI */ } else { DHD_ERROR(("%s: PCIe IRQ is not registered\n", __FUNCTION__)); } diff --git a/bcmdhd.1.579.77.41.1.cn/dhd_pno.c b/bcmdhd.1.579.77.41.1.cn/dhd_pno.c index c553733..a4b723d 100644 --- a/bcmdhd.1.579.77.41.1.cn/dhd_pno.c +++ b/bcmdhd.1.579.77.41.1.cn/dhd_pno.c @@ -910,6 +910,7 @@ exit: bytes_written = (int32)(bp - buf); return bytes_written; } + static int _dhd_pno_clear_all_batch_results(dhd_pub_t *dhd, struct list_head *head, bool only_last) { @@ -992,6 +993,7 @@ _dhd_pno_cfg(dhd_pub_t *dhd, uint16 *channel_list, int nchan) exit: return err; } + static int _dhd_pno_reinitialize_prof(dhd_pub_t *dhd, dhd_pno_params_t *params, dhd_pno_mode_t mode) { @@ -4007,6 +4009,7 @@ exit: kfree(buf); return err; } + int dhd_pno_deinit(dhd_pub_t *dhd) { int err = BCME_OK; diff --git a/bcmdhd.1.579.77.41.1.cn/dhd_sdio.c b/bcmdhd.1.579.77.41.1.cn/dhd_sdio.c index 1dcdd28..6d00511 100644 --- a/bcmdhd.1.579.77.41.1.cn/dhd_sdio.c +++ b/bcmdhd.1.579.77.41.1.cn/dhd_sdio.c @@ -1040,7 +1040,7 @@ dhdsdio_clk_kso_enab(dhd_bus_t *bus, bool on) uint8 wr_val = 0, rd_val, cmp_val, bmask; int err = 0; int try_cnt = 0; - return 0; + KSO_DBG(("%s> op:%s\n", __FUNCTION__, (on ? "KSO_SET" : "KSO_CLR"))); wr_val |= (on << SBSDIO_FUNC1_SLEEPCSR_KSO_SHIFT); @@ -2910,6 +2910,7 @@ dhd_bus_rxctl(struct dhd_bus *bus, uchar *msg, uint msglen) { int timeleft; uint rxlen = 0; + static uint cnt = 0; DHD_TRACE(("%s: Enter\n", __FUNCTION__)); @@ -2917,7 +2918,7 @@ dhd_bus_rxctl(struct dhd_bus *bus, uchar *msg, uint msglen) return -EIO; /* Wait until control frame is available */ - timeleft = dhd_os_ioctl_resp_wait(bus->dhd, &bus->rxlen); + timeleft = dhd_os_ioctl_resp_wait(bus->dhd, &bus->rxlen, false); dhd_os_sdlock(bus->dhd); rxlen = bus->rxlen; @@ -2925,6 +2926,32 @@ dhd_bus_rxctl(struct dhd_bus *bus, uchar *msg, uint msglen) bus->rxlen = 0; dhd_os_sdunlock(bus->dhd); + if (bus->dhd->conf->ctrl_resched > 0 && !rxlen && timeleft == 0) { + cnt++; + if (cnt <= bus->dhd->conf->ctrl_resched) { + uint32 status, retry = 0; + R_SDREG(status, &bus->regs->intstatus, retry); + if ((status & I_HMB_HOST_INT) || PKT_AVAILABLE(bus, status)) { + DHD_ERROR(("%s: reschedule dhd_dpc, cnt=%d, status=0x%x\n", + __FUNCTION__, cnt, status)); + bus->ipend = TRUE; + bus->dpc_sched = TRUE; + dhd_sched_dpc(bus->dhd); + + /* Wait until control frame is available */ + timeleft = dhd_os_ioctl_resp_wait(bus->dhd, &bus->rxlen, true); + + dhd_os_sdlock(bus->dhd); + rxlen = bus->rxlen; + bcopy(bus->rxctl, msg, MIN(msglen, rxlen)); + bus->rxlen = 0; + dhd_os_sdunlock(bus->dhd); + } + } + } else { + cnt = 0; + } + if (rxlen) { DHD_CTL(("%s: resumed on rxctl frame, got %d expected %d\n", __FUNCTION__, rxlen, msglen)); diff --git a/bcmdhd.1.579.77.41.1.cn/dhd_static_buf.c b/bcmdhd.1.579.77.41.1.cn/dhd_static_buf.c index 50573e4..33997cd 100644 --- a/bcmdhd.1.579.77.41.1.cn/dhd_static_buf.c +++ b/bcmdhd.1.579.77.41.1.cn/dhd_static_buf.c @@ -73,7 +73,7 @@ enum dhd_prealloc_index { #define DHD_PREALLOC_OSL_BUF_SIZE (STATIC_BUF_MAX_NUM * STATIC_BUF_SIZE) #define DHD_PREALLOC_WIPHY_ESCAN0_SIZE (64 * 1024) #define DHD_PREALLOC_DHD_INFO_SIZE (30 * 1024) -#define DHD_PREALLOC_MEMDUMP_RAM_SIZE (770 * 1024) +#define DHD_PREALLOC_MEMDUMP_RAM_SIZE (810 * 1024) #define DHD_PREALLOC_DHD_WLFC_HANGER_SIZE (73 * 1024) #define DHD_PREALLOC_WL_ESCAN_INFO_SIZE (66 * 1024) #ifdef CONFIG_64BIT diff --git a/bcmdhd.1.579.77.41.1.cn/include/wlioctl.h b/bcmdhd.1.579.77.41.1.cn/include/wlioctl.h index 82c4b4f..1e6a3a2 100644 --- a/bcmdhd.1.579.77.41.1.cn/include/wlioctl.h +++ b/bcmdhd.1.579.77.41.1.cn/include/wlioctl.h @@ -11554,13 +11554,6 @@ 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 */ diff --git a/bcmdhd.1.579.77.41.1.cn/wl_cfg80211.c b/bcmdhd.1.579.77.41.1.cn/wl_cfg80211.c index 1a3bcb7..852384c 100644 --- a/bcmdhd.1.579.77.41.1.cn/wl_cfg80211.c +++ b/bcmdhd.1.579.77.41.1.cn/wl_cfg80211.c @@ -3774,7 +3774,7 @@ wl_customer6_legacy_chip_check(struct bcm_cfg80211 *cfg, dtoh32(revinfo.deviceid), dtoh32(revinfo.vendorid), dtoh32(revinfo.chipnum))); chipnum = revinfo.chipnum; if ((chipnum == BCM4350_CHIP_ID) || (chipnum == BCM4355_CHIP_ID) || - (chipnum == BCM4345_CHIP_ID)) { + (chipnum == BCM4345_CHIP_ID) || (chipnum == BCM43430_CHIP_ID)) { /* WAR required */ return true; } -- 2.20.1