PD#146795 wifi: update bcmdhd_1_201_59_x driver
authorRongjun Chen <rongjun.chen@amlogic.com>
Fri, 30 Jun 2017 08:48:15 +0000 (16:48 +0800)
committerRongjun Chen <rongjun.chen@amlogic.com>
Fri, 30 Jun 2017 09:01:13 +0000 (17:01 +0800)
Change-Id: Id43b4ca40977e93f9d500edf337309f5c22fc16e

bcmdhd_1_201_59_x/Kconfig
bcmdhd_1_201_59_x/Makefile
bcmdhd_1_201_59_x/bcmsdh_sdmmc.c
bcmdhd_1_201_59_x/dhd_gpio.c
bcmdhd_1_201_59_x/dhd_sdio.c
bcmdhd_1_201_59_x/include/linuxver.h
bcmdhd_1_201_59_x/include/sbchipc.h
bcmdhd_1_201_59_x/linux_osl.c
bcmdhd_1_201_59_x/siutils.c
bcmdhd_1_201_59_x/wl_cfg80211.c
bcmdhd_1_201_59_x/wl_cfg80211.h

index bba8b4f59ae25d964d59f85b8cd6e3a3be6f2cd2..8c5eb78e70139767b3a16c901779d33a56bdb9ec 100644 (file)
@@ -1,18 +1,18 @@
-config BCMDHD
+config BCM6359
        tristate "Broadcom FullMAC wireless cards support"
        ---help---
          This module adds support for wireless adapters based on
          Broadcom FullMAC chipset.
 
 config BCMDHD_FW_PATH
-       depends on BCMDHD
+       depends on BCM6359
        string "Firmware path"
        default "/system/etc/firmware/fw_bcmdhd.bin"
        ---help---
          Path to the firmware file.
 
 config BCMDHD_NVRAM_PATH
-       depends on BCMDHD
+       depends on BCM6359
        string "NVRAM path"
        default "/system/etc/firmware/nvram.txt"
        ---help---
@@ -20,7 +20,7 @@ config BCMDHD_NVRAM_PATH
 
 config BCMDHD_WEXT
        bool "Enable WEXT support"
-       depends on BCMDHD && CFG80211 = n
+       depends on BCM6359 && CFG80211 = n
        select WIRELESS_EXT
        select WEXT_PRIV
        help
@@ -28,30 +28,30 @@ config BCMDHD_WEXT
 
 choice
        prompt "Enable Chip Interface"
-       depends on BCMDHD
+       depends on BCM6359
        ---help---
                Enable Chip Interface.
 config BCMDHD_SDIO
                bool "SDIO bus interface support"
-               depends on BCMDHD && MMC
+               depends on BCM6359 && MMC
 config BCMDHD_PCIE
                bool "PCIe bus interface support"
-               depends on BCMDHD && PCI
+               depends on BCM6359 && PCI
 endchoice
 
 choice
-       depends on BCMDHD && BCMDHD_SDIO
+       depends on BCM6359 && BCMDHD_SDIO
        prompt "Interrupt type"
        ---help---
                Interrupt type
 config BCMDHD_OOB
-       depends on BCMDHD && BCMDHD_SDIO
+       depends on BCM6359 && BCMDHD_SDIO
        bool "Out-of-Band Interrupt"
        default y
        ---help---
                Interrupt from WL_HOST_WAKE.
 config BCMDHD_SDIO_IRQ
-       depends on BCMDHD && BCMDHD_SDIO
+       depends on BCM6359 && BCMDHD_SDIO
        bool "In-Band Interrupt"
        ---help---
          Interrupt from SDIO DAT[1]
index bd92d25353a3891b2f07308de8c3e5b8622fcd2b..230d8ede067aac60ad6b1fd75160cfd8b7e6785e 100644 (file)
@@ -5,7 +5,7 @@
 CONFIG_BCMDHD_SDIO := y
 #CONFIG_BCMDHD_PCIE := y
 
-export CONFIG_BCMDHD = m
+export CONFIG_BCM6359 = m
 export CONFIG_BCMDHD_OOB = y
 
 DHDCFLAGS = -Wall -Wstrict-prototypes -Dlinux -DBCMDRIVER -DSDTEST       \
@@ -15,8 +15,8 @@ DHDCFLAGS = -Wall -Wstrict-prototypes -Dlinux -DBCMDRIVER -DSDTEST       \
        -DKEEP_ALIVE -DPKT_FILTER_SUPPORT -DPNO_SUPPORT -DDHDTCPACK_SUPPRESS  \
        -DDHD_DONOT_FORWARD_BCMEVENT_AS_NETWORK_PKT -DRXFRAME_THREAD          \
        -DSWTXGLOM                                                            \
-       -DENABLE_INSMOD_NO_FW_LOAD -DGET_CUSTOM_MAC_ENABLE                   \
-       -I$(src) -I$(src)/include
+       -DENABLE_INSMOD_NO_FW_LOAD                                            \
+        -I$(src) -I$(src)/include
 
 DHDOFILES = aiutils.o siutils.o sbutils.o bcmutils.o bcmwifi_channels.o \
        dhd_linux.o dhd_linux_platdev.o dhd_linux_sched.o dhd_pno.o \
@@ -52,7 +52,7 @@ DHDOFILES += dhd_pcie.o dhd_pcie_linux.o pcie_core.o dhd_flowring.o \
        dhd_msgbuf.o
 endif
 
-obj-$(CONFIG_BCMDHD) += dhd.o
+obj-$(CONFIG_BCM6359) += dhd.o
 dhd-objs += $(DHDOFILES)
 
 #ifeq ($(CONFIG_MACH_ODROID_4210),y)
@@ -92,13 +92,14 @@ DHDCFLAGS += -DVSDB -DWL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
 DHDCFLAGS += -DWLTDLS -DMIRACAST_AMPDU_SIZE=8 -DPROP_TXSTATUS_VSDB
 endif
 EXTRA_CFLAGS = $(DHDCFLAGS)
-ifeq ($(CONFIG_BCMDHD),m)
+ifeq ($(CONFIG_BCM6359),m)
 DHDCFLAGS += -DMULTIPLE_SUPPLICANT
 EXTRA_LDFLAGS += --strip-debug
 else
 DHDCFLAGS += -DBUILD_IN_KERNEL
 endif
 
+
 ARCH ?= arm64
 CROSS_COMPILE ?=aarch64-linux-gnu-
 KDIR ?=/mnt/fileroot/jiamin.miao/amlogic_kernel/common
index 0805697c0084e4201d9a0c9a9da2b1729f76bd86..9239bb9bfd558a994a7683abb5c8db7439fcf3f7 100644 (file)
@@ -706,7 +706,7 @@ exit:
 }
 
 #if (defined(OOB_INTR_ONLY) && defined(HW_OOB)) || defined(FORCE_WOWLAN)
-extern int wifi_irq_trigger_level(void);
+//extern int wifi_irq_trigger_level(void);
 SDIOH_API_RC
 sdioh_enable_hw_oob_intr(sdioh_info_t *sd, bool enable)
 {
@@ -714,9 +714,9 @@ sdioh_enable_hw_oob_intr(sdioh_info_t *sd, bool enable)
        uint8 data;
 
        if (enable) {
-               if (wifi_irq_trigger_level() == GPIO_IRQ_LOW)
-                       data = SDIO_SEPINT_MASK | SDIO_SEPINT_OE;
-               else
+               //if (wifi_irq_trigger_level() == GPIO_IRQ_LOW)
+               //      data = SDIO_SEPINT_MASK | SDIO_SEPINT_OE;
+               //else
                        data = SDIO_SEPINT_MASK | SDIO_SEPINT_OE | SDIO_SEPINT_ACT_HI;
        }
        else
index aee2b3b0f9ff0e296edb05b1074c37d1daf73005..cceb9211f33aca1e3d7a88db296e570cb1708f03 100644 (file)
@@ -18,7 +18,6 @@ extern int wifi_irq_num(void);
 #endif
 #endif
 
-extern u8 *wifi_get_mac(void);
 struct wifi_platform_data dhd_wlan_control = {0};
 
 #ifdef CUSTOMER_OOB
@@ -129,11 +128,7 @@ int bcm_wlan_get_mac_address(unsigned char *buf)
                bcopy((char *)&ea_example, buf, sizeof(struct ether_addr));
        }
 #endif /* EXAMPLE_GET_MAC */
-       bcopy((char *)wifi_get_mac(), buf, sizeof(struct ether_addr));
-       if (buf[0] == 0xff) {
-               printf("custom wifi mac is not set\n");
-               err = -1;
-       }
+
        return err;
 }
 
index 1e4e79c6429dc837e4b4befb416db44d0d3854fc..4bc076e7cd05973b71434f51b5ef4b27b443504a 100644 (file)
@@ -749,7 +749,6 @@ dhdsdio_sr_cap(dhd_bus_t *bus)
                (bus->sih->chip == BCM4354_CHIP_ID) ||
                (bus->sih->chip == BCM4356_CHIP_ID) ||
                (bus->sih->chip == BCM4358_CHIP_ID) ||
-               (bus->sih->chip == BCM43569_CHIP_ID) ||
                (bus->sih->chip == BCM4371_CHIP_ID) ||
                (BCM4349_CHIP(bus->sih->chip))          ||
                (bus->sih->chip == BCM4350_CHIP_ID)) {
@@ -773,7 +772,6 @@ dhdsdio_sr_cap(dhd_bus_t *bus)
                (bus->sih->chip == BCM4356_CHIP_ID) ||
                (bus->sih->chip == BCM4358_CHIP_ID) ||
                (bus->sih->chip == BCM4371_CHIP_ID) ||
-               (bus->sih->chip == BCM43569_CHIP_ID) ||
                (bus->sih->chip == BCM4350_CHIP_ID)) {
                uint32 enabval = 0;
                addr = SI_ENUM_BASE + OFFSETOF(chipcregs_t, chipcontrol_addr);
@@ -787,7 +785,6 @@ dhdsdio_sr_cap(dhd_bus_t *bus)
                        (bus->sih->chip == BCM4354_CHIP_ID) ||
                        (bus->sih->chip == BCM4356_CHIP_ID) ||
                        (bus->sih->chip == BCM4358_CHIP_ID) ||
-                       (bus->sih->chip == BCM43569_CHIP_ID) ||
                        (bus->sih->chip == BCM4371_CHIP_ID))
                        enabval &= CC_CHIPCTRL3_SR_ENG_ENABLE;
 
@@ -7576,8 +7573,6 @@ dhdsdio_chipmatch(uint16 chipid)
                return TRUE;
        if (chipid == BCM4358_CHIP_ID)
                return TRUE;
-       if (chipid == BCM43569_CHIP_ID)
-               return TRUE;
        if (chipid == BCM4371_CHIP_ID)
                return TRUE;
        if (chipid == BCM43430_CHIP_ID)
@@ -8229,7 +8224,6 @@ dhdsdio_probe_attach(struct dhd_bus *bus, osl_t *osh, void *sdh, void *regsva,
                        case BCM4354_CHIP_ID:
                        case BCM4356_CHIP_ID:
                        case BCM4358_CHIP_ID:
-                       case BCM43569_CHIP_ID:
                        case BCM4371_CHIP_ID:
                                bus->dongle_ram_base = CR4_4350_RAM_BASE;
                                break;
@@ -8242,7 +8236,7 @@ dhdsdio_probe_attach(struct dhd_bus *bus, osl_t *osh, void *sdh, void *regsva,
                                        ? CR4_4345_LT_C0_RAM_BASE : CR4_4345_GE_C0_RAM_BASE;
                                break;
                        case BCM4349_CHIP_GRPID:
-                               bus->dongle_ram_base = CR4_4349_RAM_BASE;
+                               bus->dongle_ram_base = ((bus->sih->chiprev < 9) ? CR4_4349_RAM_BASE : CR4_4349_RAM_BASE_FROM_REV_9);
                                break;
                        default:
                                bus->dongle_ram_base = 0;
@@ -9276,9 +9270,9 @@ dhd_bus_devreset(dhd_pub_t *dhdp, uint8 flag)
                                        }
                                } else
                                        bcmerror = BCME_SDIO_ERROR;
-                       } else
+                       } else {
                                bcmerror = BCME_SDIO_ERROR;
-
+                       }
                                dhd_os_sdunlock(dhdp);
                } else {
                        bcmerror = BCME_SDIO_ERROR;
index c39e3dfed0579665260bacb12e62f69017740214..7e13746ea2000b3c0e2912b96697c901ae00fe9f 100644 (file)
@@ -586,16 +586,10 @@ static inline bool binary_sema_up(tsk_ctl_t *tsk)
        (tsk_ctl)->proc_name = name;  \
        (tsk_ctl)->terminated = FALSE; \
        (tsk_ctl)->p_task  = kthread_run(thread_func, tsk_ctl, (char*)name); \
-       if (!IS_ERR((tsk_ctl)->p_task)) { \
-               (tsk_ctl)->thr_pid = (tsk_ctl)->p_task->pid; \
-               DBG_THR(("%s(): thread:%s:%lx started\n", __FUNCTION__, \
-                       (tsk_ctl)->proc_name, (tsk_ctl)->thr_pid)); \
-       } else {\
-               (tsk_ctl)->thr_pid = -1; \
-               DBG_THR(("%s(): thread:%s:%lx create fail\n", __FUNCTION__, \
-                       (tsk_ctl)->proc_name, (tsk_ctl)->thr_pid)); \
-       }\
+       (tsk_ctl)->thr_pid = (tsk_ctl)->p_task->pid; \
        spin_lock_init(&((tsk_ctl)->spinlock)); \
+       DBG_THR(("%s(): thread:%s:%lx started\n", __FUNCTION__, \
+               (tsk_ctl)->proc_name, (tsk_ctl)->thr_pid)); \
 }
 
 #define PROC_STOP(tsk_ctl) \
index f08e98ad8e27d506f501fdcad214d32e93f514fb..0421573fa6f50f477e0992080ca32a7eb18da33c 100644 (file)
@@ -2706,6 +2706,7 @@ typedef volatile struct {
 #define RES4349_MACPHY_CLKAVAIL                30
 
 #define CR4_4349_RAM_BASE                      (0x180000)
+#define CR4_4349_RAM_BASE_FROM_REV_9           (0x160000)
 #define CC4_4349_SR_ASM_ADDR           (0x48)
 
 #define CST4349_CHIPMODE_SDIOD(cs)     (((cs) & (1 << 6)) != 0)        /* SDIO */
index 23014835032be7887b711b03771171da9fd5e55e..d7ed67178c9e363be7b1c1629024960bd3fe91da 100644 (file)
@@ -23,7 +23,9 @@
 #include <bcmutils.h>
 #include <linux/delay.h>
 #include <pcicfg.h>
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 8, 0))
 #include <asm-generic/pci-dma-compat.h>
+#endif
 
 
 
index 29d6dc2f3334605b43857efbb38a016b95bc2a23..dbd03cab5982418eaa299ab0963d50c5cda0e490 100644 (file)
@@ -467,12 +467,12 @@ si_doattach(si_info_t *sii, uint devid, osl_t *osh, void *regs,
        }
 
        sih->bustype = bustype;
-       if (bustype != BUSTYPE(bustype)) {
+/*     if (bustype != BUSTYPE(bustype)) {
                SI_ERROR(("si_doattach: bus type %d does not match configured bus type %d\n",
                        bustype, BUSTYPE(bustype)));
                return NULL;
        }
-
+*/
        /* bus/core/clk setup for register access */
        if (!si_buscore_prep(sii, bustype, devid, sdh)) {
                SI_ERROR(("si_doattach: si_core_clk_prep failed %d\n", bustype));
index 7f10d51274d05872a763abf27dfd9533553169a6..b9909fc0d5abe915245bb089cd4336ddd42a1ed7 100644 (file)
@@ -317,9 +317,15 @@ static s32 wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
        struct cfg80211_ibss_params *params);
 static s32 wl_cfg80211_leave_ibss(struct wiphy *wiphy,
        struct net_device *dev);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
+static s32 wl_cfg80211_get_station(struct wiphy *wiphy,
+       struct net_device *dev, const u8 *mac,
+       struct station_info *sinfo);
+#else
 static s32 wl_cfg80211_get_station(struct wiphy *wiphy,
        struct net_device *dev, u8 *mac,
        struct station_info *sinfo);
+#endif
 static s32 wl_cfg80211_set_power_mgmt(struct wiphy *wiphy,
        struct net_device *dev, bool enabled,
        s32 timeout);
@@ -361,10 +367,27 @@ static s32 wl_cfg80211_resume(struct wiphy *wiphy);
        2, 0))
 static s32 wl_cfg80211_mgmt_tx_cancel_wait(struct wiphy *wiphy,
        bcm_struct_cfgdev *cfgdev, u64 cookie);
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0))
+static s32 wl_cfg80211_del_station(
+               struct wiphy *wiphy, struct net_device *ndev,
+               struct station_del_parameters *params);
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
+static s32 wl_cfg80211_del_station(struct wiphy *wiphy,
+       struct net_device *ndev, const u8* mac_addr);
+#else
 static s32 wl_cfg80211_del_station(struct wiphy *wiphy,
        struct net_device *ndev, u8* mac_addr);
+#endif
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
+static s32 wl_cfg80211_change_station(struct wiphy *wiphy,
+       struct net_device *dev, const u8 *mac, struct station_parameters *params);
+#else
 static s32 wl_cfg80211_change_station(struct wiphy *wiphy,
        struct net_device *dev, u8 *mac, struct station_parameters *params);
+#endif
+
 #endif /* WL_SUPPORT_BACKPORTED_KPATCHES || KERNEL_VER >= KERNEL_VERSION(3, 2, 0)) */
 static s32
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) || defined(WL_COMPAT_WIRELESS)
@@ -386,17 +409,34 @@ void wl_cfg80211_scan_abort(struct bcm_cfg80211 *cfg);
 static s32 wl_notify_escan_complete(struct bcm_cfg80211 *cfg,
        struct net_device *ndev, bool aborted, bool fw_abort);
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0)) || defined(WL_COMPAT_WIRELESS)
-#if defined(CONFIG_ARCH_MSM) && defined(TDLS_MGMT_VERSION2)
+#if (defined(CONFIG_ARCH_MSM) && defined(TDLS_MGMT_VERSION2)) || (LINUX_VERSION_CODE < \
+       KERNEL_VERSION(3, 16, 0) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0))
 static s32 wl_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
        u8 *peer, u8 action_code, u8 dialog_token, u16 status_code,
        u32 peer_capability, const u8 *data, size_t len);
+#elif ((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)) && \
+               (LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)))
+static s32 wl_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
+       const u8 *peer, u8 action_code, u8 dialog_token, u16 status_code,
+       u32 peer_capability, const u8 *data, size_t len);
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
+static s32 wl_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
+       const u8 *peer, u8 action_code, u8 dialog_token, u16 status_code,
+       u32 peer_capability, bool initiator, const u8 *data, size_t len);
 #else
 static s32 wl_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
        u8 *peer, u8 action_code, u8 dialog_token, u16 status_code, const u8 *data,
        size_t len);
 #endif /* CONFIG_ARCH_MSM && TDLS_MGMT_VERSION2 */
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
+static s32 wl_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
+       const u8 *peer, enum nl80211_tdls_operation oper);
+#else
 static s32 wl_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
        u8 *peer, enum nl80211_tdls_operation oper);
+#endif
+
 #endif /* LINUX_VERSION > KERNEL_VERSION(3,2,0) || WL_COMPAT_WIRELESS */
 #ifdef WL_SCHED_SCAN
 static int wl_cfg80211_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev);
@@ -699,6 +739,21 @@ static s8 wl_dbg_estr[][WL_DBG_ESTR_MAX] = {
 };
 #endif                         /* WL_DBG_LEVEL */
 
+#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
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0))
+#define CFG80211_DISCONNECTED(dev, reason, ie, len, loc_gen, gfp) \
+       cfg80211_disconnected(dev, reason, ie, len, gfp);
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0))
+#define CFG80211_DISCONNECTED(dev, reason, ie, len, loc_gen, gfp) \
+       cfg80211_disconnected(dev, reason, ie, len, loc_gen, gfp);
+#endif
+
 #define CHAN2G(_channel, _freq, _flags) {                      \
        .band                   = IEEE80211_BAND_2GHZ,          \
        .center_freq            = (_freq),                      \
@@ -1364,6 +1419,9 @@ wl_cfg80211_add_virtual_iface(struct wiphy *wiphy,
 #else
        char *name,
 #endif /* WL_CFG80211_P2P_DEV_IF */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0))
+       unsigned char name_assign_type,
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) */
        enum nl80211_iftype type, u32 *flags,
        struct vif_params *params)
 {
@@ -5060,7 +5118,7 @@ wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,
        swap_key_to_BE(&key);
        memset(&params, 0, sizeof(params));
        params.key_len = (u8) min_t(u8, DOT11_MAX_KEY_SIZE, key.len);
-       memcpy(params.key, key.data, params.key_len);
+       memcpy((void*)params.key, key.data, params.key_len);
 
        err = wldev_iovar_getint_bsscfg(dev, "wsec", &wsec, bssidx);
        if (unlikely(err)) {
@@ -5129,8 +5187,13 @@ wl_cfg80211_config_default_mgmt_key(struct wiphy *wiphy,
 }
 
 static s32
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
+wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
+       const u8 *mac, struct station_info *sinfo)
+#else
 wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
        u8 *mac, struct station_info *sinfo)
+#endif
 {
        struct bcm_cfg80211 *cfg = wiphy_priv(wiphy);
        scb_val_t scb_val;
@@ -5151,7 +5214,7 @@ wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
                        WL_ERR(("GET STA INFO failed, %d\n", err));
                        return err;
                }
-               sinfo->filled = STATION_INFO_INACTIVE_TIME;
+               sinfo->filled = STA_INFO_BIT(INFO_INACTIVE_TIME);
                sta = (sta_info_t *)cfg->ioctl_buf;
                sta->len = dtoh16(sta->len);
                sta->cap = dtoh16(sta->cap);
@@ -5161,7 +5224,7 @@ wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
                sinfo->inactive_time = sta->idle * 1000;
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) || defined(WL_COMPAT_WIRELESS)
                if (sta->flags & WL_STA_ASSOC) {
-                       sinfo->filled |= STATION_INFO_CONNECTED_TIME;
+                       sinfo->filled |= STA_INFO_BIT(INFO_CONNECTED_TIME);
                        sinfo->connected_time = sta->in;
                }
                WL_INFORM(("STA %s : idle time : %d sec, connected time :%d ms\n",
@@ -5212,7 +5275,7 @@ wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
                        int rxpktglom;
 #endif
                        rate = dtoh32(rate);
-                       sinfo->filled |= STATION_INFO_TX_BITRATE;
+                       sinfo->filled |= STA_INFO_BIT(INFO_TX_BITRATE);
                        sinfo->txrate.legacy = rate * 5;
                        WL_DBG(("Rate %d Mbps\n", (rate / 2)));
 #if defined(USE_DYNAMIC_MAXPKT_RXGLOM)
@@ -5257,16 +5320,16 @@ wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
                // terence 20150419: limit the max. rssi to -2 or the bss will be filtered out in android OS
                rssi = MIN(rssi, RSSI_MAXVAL);
 #endif
-               sinfo->filled |= STATION_INFO_SIGNAL;
+               sinfo->filled |= STA_INFO_BIT(INFO_SIGNAL);
                sinfo->signal = rssi;
                WL_DBG(("RSSI %d dBm\n", rssi));
                err = wldev_ioctl(dev, WLC_GET_PKTCNTS, &pktcnt,
                        sizeof(pktcnt), false);
                if (!err) {
-                       sinfo->filled |= (STATION_INFO_RX_PACKETS |
-                               STATION_INFO_RX_DROP_MISC |
-                               STATION_INFO_TX_PACKETS |
-                               STATION_INFO_TX_FAILED);
+                       sinfo->filled |= (STA_INFO_BIT(INFO_RX_PACKETS) |
+                               STA_INFO_BIT(INFO_RX_DROP_MISC) |
+                               STA_INFO_BIT(INFO_TX_PACKETS) |
+                               STA_INFO_BIT(INFO_TX_FAILED));
                        sinfo->rx_packets = pktcnt.rx_good_pkt;
                        sinfo->rx_dropped_misc = pktcnt.rx_bad_pkt;
                        sinfo->tx_packets = pktcnt.tx_good_pkt;
@@ -5281,7 +5344,8 @@ get_station_err:
                        /* Disconnect due to zero BSSID or error to get RSSI */
                        WL_ERR(("force cfg80211_disconnected: %d\n", err));
                        wl_clr_drv_status(cfg, CONNECTED, dev);
-                       cfg80211_disconnected(dev, 0, NULL, 0, GFP_KERNEL);
+                       //cfg80211_disconnected(dev, 0, NULL, 0, GFP_KERNEL);
+                       CFG80211_DISCONNECTED(dev, 0, NULL, 0, false, GFP_KERNEL);
                        wl_link_down(cfg);
                }
        }
@@ -5398,6 +5462,9 @@ wl_cfg80211_suspend(struct wiphy *wiphy)
        struct net_info *iter, *next;
        struct net_device *ndev = bcmcfg_to_prmry_ndev(cfg);
        unsigned long flags;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0))
+       struct cfg80211_scan_info info;
+#endif
        if (unlikely(!wl_get_drv_status(cfg, READY, ndev))) {
                WL_INFORM(("device is not ready : status (%d)\n",
                        (int)cfg->status));
@@ -5407,7 +5474,12 @@ wl_cfg80211_suspend(struct wiphy *wiphy)
                wl_set_drv_status(cfg, SCAN_ABORTING, iter->ndev);
        spin_lock_irqsave(&cfg->cfgdrv_lock, flags);
        if (cfg->scan_request) {
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0))
+               info.aborted = true;
+               cfg80211_scan_done(cfg->scan_request, &info);
+#else
                cfg80211_scan_done(cfg->scan_request, true);
+#endif
                cfg->scan_request = NULL;
        }
        for_each_ndev(cfg, iter, next) {
@@ -6346,8 +6418,9 @@ wl_cfg80211_mgmt_tx(struct wiphy *wiphy, bcm_struct_cfgdev *cfgdev,
                        if (dev == wl_to_p2p_bss_ndev(cfg, P2PAPI_BSSCFG_CONNECTION))
                                dev = bcmcfg_to_prmry_ndev(cfg);
 #endif
-                       if ((dev == bcmcfg_to_prmry_ndev(cfg)) && cfg->p2p)
+                       if ((dev == bcmcfg_to_prmry_ndev(cfg)) && cfg->p2p) {
                                bssidx = wl_to_p2p_bss_bssidx(cfg, P2PAPI_BSSCFG_DEVICE);
+                       }
                                wl_cfgp2p_set_management_ie(cfg, dev, bssidx,
                                VNDR_IE_PRBRSP_FLAG, (u8 *)(buf + ie_offset), ie_len);
                        cfg80211_mgmt_tx_status(cfgdev, *cookie, buf, len, true, GFP_KERNEL);
@@ -7838,10 +7911,21 @@ static s32 wl_cfg80211_hostapd_sec(
 #if defined(WL_SUPPORT_BACKPORTED_KPATCHES) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3, \
        2, 0))
 static s32
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0))
+wl_cfg80211_del_station(
+               struct wiphy *wiphy, struct net_device *ndev,
+               struct station_del_parameters *params)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
+wl_cfg80211_del_station(
+       struct wiphy *wiphy,
+       struct net_device *ndev,
+       const u8* mac_addr)
+#else
 wl_cfg80211_del_station(
        struct wiphy *wiphy,
        struct net_device *ndev,
        u8* mac_addr)
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)) */
 {
        struct net_device *dev;
        struct bcm_cfg80211 *cfg = wiphy_priv(wiphy);
@@ -7852,6 +7936,9 @@ wl_cfg80211_del_station(
                sizeof(struct ether_addr) + sizeof(uint)] = {0};
        struct maclist *assoc_maclist = (struct maclist *)mac_buf;
        int num_associated = 0;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0))
+       const u8 *mac_addr = params->mac;
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)) */
 
        WL_DBG(("Entry\n"));
        if (mac_addr == NULL) {
@@ -7896,11 +7983,19 @@ wl_cfg80211_del_station(
 }
 
 static s32
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
+wl_cfg80211_change_station(
+       struct wiphy *wiphy,
+       struct net_device *dev,
+       const u8 *mac,
+       struct station_parameters *params)
+#else
 wl_cfg80211_change_station(
        struct wiphy *wiphy,
        struct net_device *dev,
        u8 *mac,
        struct station_parameters *params)
+#endif
 {
        int err;
        struct bcm_cfg80211 *cfg = wiphy_priv(wiphy);
@@ -7911,13 +8006,21 @@ wl_cfg80211_change_station(
                return -ENOTSUPP;
 
        if (!(params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED))) {
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
+               err = wldev_ioctl(primary_ndev, WLC_SCB_DEAUTHORIZE, (u8 *)mac, ETH_ALEN, true);
+#else
                err = wldev_ioctl(primary_ndev, WLC_SCB_DEAUTHORIZE, mac, ETH_ALEN, true);
+#endif
                if (err)
                        WL_ERR(("WLC_SCB_DEAUTHORIZE error (%d)\n", err));
                return err;
        }
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
+       err = wldev_ioctl(primary_ndev, WLC_SCB_AUTHORIZE, (u8 *)mac, ETH_ALEN, true);
+#else
        err = wldev_ioctl(primary_ndev, WLC_SCB_AUTHORIZE, mac, ETH_ALEN, true);
+#endif
        if (err)
                WL_ERR(("WLC_SCB_AUTHORIZE error (%d)\n", err));
        return err;
@@ -9418,7 +9521,9 @@ exit:
        sinfo.filled = 0;
        if (((event == WLC_E_ASSOC_IND) || (event == WLC_E_REASSOC_IND)) &&
                reason == DOT11_SC_SUCCESS) {
-               sinfo.filled = STATION_INFO_ASSOC_REQ_IES;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0))
+               sinfo.filled = STA_INFO_BIT(INFO_ASSOC_REQ_IES);
+#endif /*  (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)) */
                if (!data) {
                        WL_ERR(("No IEs present in ASSOC/REASSOC_IND"));
                        return -EINVAL;
@@ -9633,7 +9738,8 @@ wl_notify_connect_status(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
                                                WL_ERR(("WLC_DISASSOC error %d\n", err));
                                                err = 0;
                                        }
-                                       cfg80211_disconnected(ndev, reason, NULL, 0, GFP_KERNEL);
+//                                     cfg80211_disconnected(ndev, reason, NULL, 0, GFP_KERNEL);
+                                       CFG80211_DISCONNECTED(ndev, reason, NULL, 0, false, GFP_KERNEL);
                                        wl_link_down(cfg);
                                        wl_init_prof(cfg, ndev);
                                }
@@ -10182,7 +10288,8 @@ wl_notify_pfn_status(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
 #ifndef WL_SCHED_SCAN
        mutex_lock(&cfg->usr_sync);
        /* TODO: Use cfg80211_sched_scan_results(wiphy); */
-       cfg80211_disconnected(ndev, 0, NULL, 0, GFP_KERNEL);
+       //cfg80211_disconnected(ndev, 0, NULL, 0, GFP_KERNEL);
+       CFG80211_DISCONNECTED(ndev, 0, NULL, 0, false, GFP_KERNEL);
        mutex_unlock(&cfg->usr_sync);
 #else
        /* If cfg80211 scheduled scan is supported, report the pno results via sched
@@ -10204,6 +10311,9 @@ wl_notify_scan_status(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
        u32 len = WL_SCAN_BUF_MAX;
        s32 err = 0;
        unsigned long flags;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0))
+       struct cfg80211_scan_info info;
+#endif
 
        WL_DBG(("Enter \n"));
        if (!wl_get_drv_status(cfg, SCANNING, ndev)) {
@@ -10246,7 +10356,12 @@ scan_done_out:
        del_timer_sync(&cfg->scan_timeout);
        spin_lock_irqsave(&cfg->cfgdrv_lock, flags);
        if (cfg->scan_request) {
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0))
+               info.aborted = false;
+               cfg80211_scan_done(cfg->scan_request, &info);
+#else
                cfg80211_scan_done(cfg->scan_request, false);
+#endif
                cfg->scan_request = NULL;
        }
        spin_unlock_irqrestore(&cfg->cfgdrv_lock, flags);
@@ -10564,7 +10679,7 @@ wl_notify_rx_mgmt_frame(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
        retval = cfg80211_rx_mgmt(cfgdev, freq, 0,  mgmt_frame, mgmt_frame_len, 0);
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0))\r
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0))
        retval = cfg80211_rx_mgmt(cfgdev, freq, 0,  mgmt_frame, mgmt_frame_len, 0, GFP_ATOMIC);
 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)) || \
        defined(WL_COMPAT_WIRELESS)
@@ -11075,6 +11190,10 @@ static s32 wl_notify_escan_complete(struct bcm_cfg80211 *cfg,
        s32 err = BCME_OK;
        unsigned long flags;
        struct net_device *dev;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0))
+       struct cfg80211_scan_info info;
+       info.aborted = aborted;
+#endif
 
        WL_DBG(("Enter \n"));
        if (!ndev) {
@@ -11123,7 +11242,11 @@ static s32 wl_notify_escan_complete(struct bcm_cfg80211 *cfg,
        }
 #endif /* WL_SCHED_SCAN */
        if (likely(cfg->scan_request)) {
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0))
+               cfg80211_scan_done(cfg->scan_request, &info);
+#else
                cfg80211_scan_done(cfg->scan_request, aborted);
+#endif
                cfg->scan_request = NULL;
        }
        if (p2p_is_on(cfg))
@@ -12893,6 +13016,11 @@ 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"));
        /* Delete pm_enable_work */
        wl_add_remove_pm_enable_work(cfg, FALSE, WL_HANDLER_DEL);
@@ -12946,7 +13074,12 @@ static s32 __wl_cfg80211_down(struct bcm_cfg80211 *cfg)
 
        spin_lock_irqsave(&cfg->cfgdrv_lock, flags);
        if (cfg->scan_request) {
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0))
+               info.aborted = true;
+               cfg80211_scan_done(cfg->scan_request, &info);
+#else
                cfg80211_scan_done(cfg->scan_request, true);
+#endif
                cfg->scan_request = NULL;
        }
        spin_unlock_irqrestore(&cfg->cfgdrv_lock, flags);
@@ -13059,7 +13192,8 @@ int wl_cfg80211_hang(struct net_device *dev, u16 reason)
 
        WL_ERR(("In : chip crash eventing\n"));
        wl_add_remove_pm_enable_work(cfg, FALSE, WL_HANDLER_DEL);
-       cfg80211_disconnected(dev, reason, NULL, 0, GFP_KERNEL);
+       //cfg80211_disconnected(dev, reason, NULL, 0, GFP_KERNEL);
+       CFG80211_DISCONNECTED(dev, reason, NULL, 0, false, GFP_KERNEL);
 #if defined(RSSIAVG)
        wl_free_rssi_cache(&g_rssi_cache_ctrl);
 #endif
@@ -14321,15 +14455,25 @@ wl_tdls_event_handler(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
 
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0)) || defined(WL_COMPAT_WIRELESS)
 static s32
-#if defined(CONFIG_ARCH_MSM) && defined(TDLS_MGMT_VERSION2)
+#if (defined(CONFIG_ARCH_MSM) && defined(TDLS_MGMT_VERSION2)) || (LINUX_VERSION_CODE < \
+       KERNEL_VERSION(3, 16, 0) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0))
 wl_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
         u8 *peer, u8 action_code, u8 dialog_token, u16 status_code,
         u32 peer_capability, const u8 *data, size_t len)
+#elif ((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)) && \
+        (LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)))
+wl_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
+       const u8 *peer, u8 action_code, u8 dialog_token, u16 status_code,
+       u32 peer_capability, const u8 *data, size_t len)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
+wl_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
+       const u8 *peer, u8 action_code, u8 dialog_token, u16 status_code,
+       u32 peer_capability, bool initiator, const u8 *data, size_t len)
 #else
 wl_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
        u8 *peer, u8 action_code, u8 dialog_token, u16 status_code, const u8 *data,
        size_t len)
-#endif /* CONFIG_ARCH_MSM && TDLS_MGMT_VERSION2 */
+#endif  /* CONFIG_ARCH_MSM && TDLS_MGMT_VERSION2 */
 {
        s32 ret = 0;
 #ifdef WLTDLS
@@ -14376,8 +14520,13 @@ out:
 }
 
 static s32
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
+wl_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
+       const u8 *peer, enum nl80211_tdls_operation oper)
+#else
 wl_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
        u8 *peer, enum nl80211_tdls_operation oper)
+#endif
 {
        s32 ret = 0;
 #ifdef WLTDLS
@@ -15295,7 +15444,9 @@ int wl_cfg80211_scan_stop(bcm_struct_cfgdev *cfgdev)
        unsigned long flags;
        int clear_flag = 0;
        int ret = 0;
-
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0))
+       struct cfg80211_scan_info info;
+#endif
        WL_TRACE(("Enter\n"));
 
        cfg = g_bcm_cfg;
@@ -15311,7 +15462,12 @@ int wl_cfg80211_scan_stop(bcm_struct_cfgdev *cfgdev)
        if (cfg->scan_request && cfg->scan_request->dev == cfgdev)
 #endif
        {
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0))
+               info.aborted = true;
+               cfg80211_scan_done(cfg->scan_request, &info);
+#else
                cfg80211_scan_done(cfg->scan_request, true);
+#endif
                cfg->scan_request = NULL;
                clear_flag = 1;
        }
index 6d4cb3d0c692a390dfbcb6def4c5e680777fc6a5..6a02b9da7cb9d9631fbe89d5bd50ba4d753b8d79 100644 (file)
@@ -937,6 +937,14 @@ wl_get_netinfo_by_netdev(struct bcm_cfg80211 *cfg, struct net_device *ndev)
        ((wl_cfgp2p_find_wpsie((u8 *)_sme->ie, _sme->ie_len) != NULL) && \
         (!_sme->crypto.n_ciphers_pairwise) && \
         (!_sme->crypto.cipher_group))
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0))
+#define STA_INFO_BIT(info) (1ul << NL80211_STA_ ## info)
+#define strnicmp(str1, str2, len) strncasecmp((str1), (str2), (len))
+#else
+#define STA_INFO_BIT(info) (STATION_ ## info)
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)) */
+
 extern s32 wl_cfg80211_attach(struct net_device *ndev, dhd_pub_t *context);
 extern s32 wl_cfg80211_attach_post(struct net_device *ndev);
 extern void wl_cfg80211_detach(void *para);