Update to 5.90.125.33
authorGreg Goldman <ggoldman@broadcom.com>
Wed, 29 Jun 2011 21:34:18 +0000 (14:34 -0700)
committerDmitry Shmidt <dimitrysh@google.com>
Sat, 2 Jul 2011 00:04:11 +0000 (17:04 -0700)
Add logic to get MAC address before firmware is loaded

Change-Id: I2151a0fcc5aab914cfec8bfedf761b9f06445d1a
Signed-off-by: Howard M. Harte <hharte@broadcom.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
drivers/net/wireless/bcmdhd/dhd.h
drivers/net/wireless/bcmdhd/dhd_common.c
drivers/net/wireless/bcmdhd/dhd_custom_gpio.c
drivers/net/wireless/bcmdhd/dhd_linux.c
drivers/net/wireless/bcmdhd/dhd_sdio.c
drivers/net/wireless/bcmdhd/include/epivers.h
drivers/net/wireless/bcmdhd/linux_osl.c
drivers/net/wireless/bcmdhd/wl_android.c
drivers/net/wireless/bcmdhd/wl_cfg80211.c

index 4a7f571c766aaf987bd92fa28cb60b64cff79f78..260632677f5c6ad2139842bebc356d62b8c8f9b4 100644 (file)
@@ -248,6 +248,9 @@ typedef struct dhd_cmn {
 #endif /* DHDTHREAD */
 #define DHD_IF_VIF     0x01    /* Virtual IF (Hidden from user) */
 
+unsigned long dhd_os_spin_lock(dhd_pub_t *pub);
+void dhd_os_spin_unlock(dhd_pub_t *pub, unsigned long flags);
+
 /*  Wakelock Functions */
 extern int dhd_os_wake_lock(dhd_pub_t *pub);
 extern int dhd_os_wake_unlock(dhd_pub_t *pub);
@@ -280,9 +283,6 @@ inline static void MUTEX_UNLOCK_SOFTAP_SET(dhd_pub_t * dhdp)
 #define DHD_OS_WAKE_LOCK_TIMEOUT(pub)          dhd_os_wake_lock_timeout(pub)
 #define DHD_OS_WAKE_LOCK_TIMEOUT_ENABLE(pub)   dhd_os_wake_lock_timeout_enable(pub)
 
-extern unsigned long dhd_os_spin_lock(dhd_pub_t *pub);
-extern void dhd_os_spin_unlock(dhd_pub_t *pub, unsigned long flags);
-
 
 /* interface operations (register, remove) should be atomic, use this lock to prevent race
  * condition among wifi on/off and interface operation functions
index 39ded0107e81e994cc9f6906ccbb90ba84a6d691..b17e580e11660d3a2be4187e5668f3503386d06b 100644 (file)
@@ -91,7 +91,6 @@ extern int dhd_change_mtu(dhd_pub_t *dhd, int new_mtu, int ifidx);
 bool ap_cfg_running = FALSE;
 bool ap_fw_loaded = FALSE;
 
-
 #if defined(KEEP_ALIVE)
 int dhd_keep_alive_onoff(dhd_pub_t *dhd, int ka_on);
 #endif /* KEEP_ALIVE */
@@ -1552,37 +1551,27 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
        uint32 mpc = 0; /* Turn MPC off for AP/APSTA mode */
        uint32 apsta = 1; /* Enable APSTA mode */
 #endif
-#ifdef GET_CUSTOM_MAC_ENABLE
-       struct ether_addr ea_addr;
-#endif /* GET_CUSTOM_MAC_ENABLE */
 
 #ifdef GET_CUSTOM_MAC_ENABLE
-       /*
-       ** Read MAC address from external customer place
-       ** NOTE that default mac address has to be present in otp or nvram file
-       ** to bring up firmware but unique per board mac address maybe provided
-       ** by customer code
-       */
-       ret = dhd_custom_get_mac_address(ea_addr.octet);
-       if (!ret) {
-               bcm_mkiovar("cur_etheraddr", (void *)&ea_addr, ETHER_ADDR_LEN, buf, sizeof(buf));
+       /* MAC address already defined in dhd->mac.octet */
+       memset(buf, 0, sizeof(buf));
+       bcm_mkiovar("cur_etheraddr", dhd->mac.octet, ETHER_ADDR_LEN, buf, sizeof(buf));
                ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, buf, sizeof(buf), TRUE, 0);
                if (ret < 0) {
                        DHD_ERROR(("%s: can't set MAC address , error=%d\n", __FUNCTION__, ret));
-               } else
-                       memcpy(dhd->mac.octet, (void *)&ea_addr, ETHER_ADDR_LEN);
-       } else {
-#endif /* GET_CUSTOM_MAC_ENABLE */
+               return BCME_NOTUP;
+       }
+#else /* GET_CUSTOM_MAC_ENABLE */
                /* Get the default device MAC address directly from firmware */
-               strcpy(iovbuf, "cur_etheraddr");
-               if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, iovbuf, sizeof(iovbuf),
+       memset(buf, 0, sizeof(buf));
+       bcm_mkiovar("cur_etheraddr", 0, 0, buf, sizeof(buf));
+       if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, buf, sizeof(buf),
                        FALSE, 0)) < 0) {
                        DHD_ERROR(("%s: can't get MAC address , error=%d\n", __FUNCTION__, ret));
                        return BCME_NOTUP;
                }
-               memcpy(dhd->mac.octet, iovbuf, ETHER_ADDR_LEN);
-#ifdef GET_CUSTOM_MAC_ENABLE
-       }
+       /* Update public MAC address after reading from Firmware */
+       memcpy(dhd->mac.octet, buf, ETHER_ADDR_LEN);
 #endif /* GET_CUSTOM_MAC_ENABLE */
 
 #ifdef SET_RANDOM_MAC_SOFTAP
@@ -1607,8 +1596,9 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
        }
 #endif /* SET_RANDOM_MAC_SOFTAP */
 
-       DHD_ERROR(("Broadcom Dongle Host Driver mac=%02x:%02x:%02x:%02x:%02x:%02x\n",
-               iovbuf[0], iovbuf[1], iovbuf[2], iovbuf[3], iovbuf[4], iovbuf[5]));
+       DHD_ERROR(("Firmware up: Broadcom Dongle Host Driver mac=%.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
+              dhd->mac.octet[0], dhd->mac.octet[1], dhd->mac.octet[2],
+              dhd->mac.octet[3], dhd->mac.octet[4], dhd->mac.octet[5]));
 
        /* Set Country code  */
        if (dhd->dhd_cspec.ccode[0] != 0) {
@@ -1787,6 +1777,16 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
        }
 #endif /* ARP_OFFLOAD_SUPPORT */
 
+#ifdef PKT_FILTER_SUPPORT
+       if (ap_fw_loaded) {
+               int i;
+               for (i = 0; i < dhd->pktfilter_count; i++) {
+                       dhd_pktfilter_offload_enable(dhd, dhd->pktfilter[i],
+                               0, dhd_master_mode);
+               }
+       }
+#endif /* PKT_FILTER_SUPPORT */
+
 
 done:
        return ret;
index b7d78d1cdc42fd5de6988eed6ae26d3b2652f60b..9750eeb23bce2d748f8ab8e8eca212468b31f1ef 100644 (file)
@@ -252,6 +252,7 @@ const struct cntry_locales_custom translate_custom_table[] = {
 void get_customized_country_code(char *country_iso_code, wl_country_t *cspec)
 {
 #if defined(CUSTOMER_HW2) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
+
        struct cntry_locales_custom *cloc_ptr;
 
        if (!cspec)
index 0908cd0992bc6d757fca42c1313a91d27eca7f79..0c0627b13b235dd99c4cb3ba6e1a64404b94e259 100644 (file)
@@ -2216,6 +2216,11 @@ dhd_open(struct net_device *net)
        ifidx = dhd_net2idx(dhd, net);
        DHD_TRACE(("%s: ifidx %d\n", __FUNCTION__, ifidx));
 
+       if (ifidx < 0) {
+               DHD_ERROR(("%s: Error: called with invalid IF\n", __FUNCTION__));
+               return -1;
+       }
+
        if (!dhd->iflist[ifidx] || dhd->iflist[ifidx]->state == WLC_E_IF_DEL) {
                DHD_ERROR(("%s: Error: called when IF already deleted\n", __FUNCTION__));
                return -1;
@@ -2944,7 +2949,8 @@ dhd_net_attach(dhd_pub_t *dhdp, int ifidx)
                goto fail;
        }
 
-       printf("%s: Broadcom Dongle Host Driver mac=%.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", net->name,
+       printf("%s: Driver up: Broadcom Dongle Host Driver mac=%.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
+               net->name,
               dhd->pub.mac.octet[0], dhd->pub.mac.octet[1], dhd->pub.mac.octet[2],
               dhd->pub.mac.octet[3], dhd->pub.mac.octet[4], dhd->pub.mac.octet[5]);
 
index 6d7d57ed96c4c68512a0973e3a7bb519af61d38b..725441ecceb253c00767e1bd91e232e32d5b82dd 100644 (file)
@@ -360,7 +360,7 @@ static const uint retry_limit = 2;
 static bool forcealign;
 
 /* Flag to indicate if we should download firmware on driver load */
-uint dhd_download_fw_on_driverload = 1;
+uint dhd_download_fw_on_driverload = TRUE;
 
 #define ALIGNMENT  4
 
@@ -482,7 +482,8 @@ static bool dhdsdio_probe_attach(dhd_bus_t *bus, osl_t *osh, void *sdh,
                                  void * regsva, uint16  devid);
 static bool dhdsdio_probe_malloc(dhd_bus_t *bus, osl_t *osh, void *sdh);
 static bool dhdsdio_probe_init(dhd_bus_t *bus, osl_t *osh, void *sdh);
-static void dhdsdio_release_dongle(dhd_bus_t *bus, osl_t *osh, bool dongle_isolation, bool reset_flag);
+static void dhdsdio_release_dongle(dhd_bus_t *bus, osl_t *osh, bool dongle_isolation,
+       bool reset_flag);
 
 static void dhd_dongle_setmemsize(struct dhd_bus *bus, int mem_size);
 static int dhd_bcmsdh_recv_buf(dhd_bus_t *bus, uint32 addr, uint fn, uint flags,
@@ -5159,6 +5160,9 @@ dhdsdio_probe(uint16 venid, uint16 devid, uint16 bus_no, uint16 slot,
        int ret;
        dhd_bus_t *bus;
        dhd_cmn_t *cmn;
+#ifdef GET_CUSTOM_MAC_ENABLE
+       struct ether_addr ea_addr;
+#endif /* GET_CUSTOM_MAC_ENABLE */
 
        /* Init global variables at run-time, not as part of the declaration.
         * This is required to support init/de-init of the driver. Initialization
@@ -5299,6 +5303,18 @@ dhdsdio_probe(uint16 venid, uint16 devid, uint16 bus_no, uint16 slot,
 
        DHD_INFO(("%s: completed!!\n", __FUNCTION__));
 
+#ifdef GET_CUSTOM_MAC_ENABLE
+       /* Read MAC address from external customer place        */
+       memset(&ea_addr, 0, sizeof(ea_addr));
+       ret = dhd_custom_get_mac_address(ea_addr.octet);
+       if (!ret) {
+               memcpy(bus->dhd->mac.octet, (void *)&ea_addr, ETHER_ADDR_LEN);
+       } else {
+               /* MAC address must be present when Driver insmod */
+               DHD_ERROR(("%s unable to get MAC address\n", __FUNCTION__));
+               goto fail;
+       }
+#endif /* GET_CUSTOM_MAC_ENABLE */
 
        /* if firmware path present try to download and bring up bus */
        if (dhd_download_fw_on_driverload && (ret = dhd_bus_start(bus->dhd)) != 0) {
@@ -5774,7 +5790,8 @@ dhdsdio_download_code_array(struct dhd_bus *bus)
 
        /* Download image */
        while ((offset + MEMBLOCK) < sizeof(dlarray)) {
-               bcmerror = dhdsdio_membytes(bus, TRUE, offset, (uint8 *) (dlarray + offset), MEMBLOCK);
+               bcmerror = dhdsdio_membytes(bus, TRUE, offset,
+                       (uint8 *) (dlarray + offset), MEMBLOCK);
                if (bcmerror) {
                        DHD_ERROR(("%s: error %d on writing %d membytes at 0x%08x\n",
                                __FUNCTION__, bcmerror, MEMBLOCK, offset));
@@ -6170,7 +6187,8 @@ dhd_bus_devreset(dhd_pub_t *dhdp, uint8 flag)
                                        DHD_TRACE(("%s: WLAN ON DONE\n", __FUNCTION__));
                                        } else {
                                                dhd_bus_stop(bus, FALSE);
-                                               dhdsdio_release_dongle(bus, bus->dhd->osh, TRUE, FALSE);
+                                               dhdsdio_release_dongle(bus, bus->dhd->osh,
+                                                       TRUE, FALSE);
                                        }
                                } else
                                        bcmerror = BCME_SDIO_ERROR;
index 32ada84248a4fa78df8f6faa2c008f6652927123..f8623f01ade4f2722e59a5bf41d7edbeb54a4e16 100644 (file)
 
 #define        EPI_RC_NUMBER           125
 
-#define        EPI_INCREMENTAL_NUMBER  32
+#define        EPI_INCREMENTAL_NUMBER  33
 
 #define        EPI_BUILD_NUMBER        0
 
-#define        EPI_VERSION             5, 90, 125, 32
+#define        EPI_VERSION             5, 90, 125, 33
 
-#define        EPI_VERSION_NUM         0x055a7d20
+#define        EPI_VERSION_NUM         0x055a7d21
 
 #define EPI_VERSION_DEV                5.90.125
 
 
-#define        EPI_VERSION_STR         "5.90.125.32"
+#define        EPI_VERSION_STR         "5.90.125.33"
 
 #endif 
index 4c4a76d60cfeddc625bba2746e23fd3df2ac66e9..bbb240840c42867b86fe8fe0396446fde4924b02 100644 (file)
@@ -603,7 +603,7 @@ osl_pktfree_static(osl_t *osh, void *p, bool send)
 {
        int i;
 
-       for (i = 0; i < MAX_STATIC_PKT_NUM*2; i++)
+       for (i = 0; i < MAX_STATIC_PKT_NUM; i++)
        {
                if (p == bcm_static_skb->skb_4k[i])
                {
@@ -611,10 +611,22 @@ osl_pktfree_static(osl_t *osh, void *p, bool send)
                        bcm_static_skb->pkt_use[i] = 0;
                        up(&bcm_static_skb->osl_pkt_sem);
 
+                       return;
+               }
+       }
+
+       for (i = 0; i < MAX_STATIC_PKT_NUM; i++)
+       {
+               if (p == bcm_static_skb->skb_8k[i])
+               {
+                       down(&bcm_static_skb->osl_pkt_sem);
+                       bcm_static_skb->pkt_use[i + MAX_STATIC_PKT_NUM] = 0;
+                       up(&bcm_static_skb->osl_pkt_sem);
 
                        return;
                }
        }
+
        return osl_pktfree(osh, p, send);
 }
 #endif 
index d7354aef5a5548f40ef19acf79faaa6605ce9958..54b5d92f65140868606b9fa89f12cc73c537f7b5 100644 (file)
@@ -91,7 +91,7 @@ extern bool ap_fw_loaded;
  * time (only) in dhd_open, subsequential wifi on will be handled by
  * wl_android_wifi_on
  */
-static int g_wifi_on = 1;
+static int g_wifi_on = TRUE;
 
 /**
  * Local (static) function definitions
@@ -319,12 +319,19 @@ exit:
 
        return ret;
 }
+
 int wl_android_init(void)
 {
        int ret = 0;
 
        dhd_msg_level = DHD_ERROR_VAL;
-       dhd_download_fw_on_driverload = 0;
+#ifdef ENABLE_INSMOD_NO_FW_LOAD
+#ifdef GET_CUSTOM_MAC_ENABLE
+       dhd_download_fw_on_driverload = FALSE;
+#else
+#error  GET_CUSTOM_MAC_ENABLE must be defined to isnmod Driver with no FW load
+#endif /* GET_CUSTOM_MAC_ENABLE */
+#endif /* ENABLE_INSMOD_NO_FW_LOAD */
        return ret;
 }
 
index 2ef334746dd1d1f7433339ae41f24f72e4d32805..3196da3559b064b3268ff532f13f98fd9ede49d8 100644 (file)
@@ -3455,11 +3455,13 @@ static s32 wl_inform_bss(struct wl_priv *wl)
        s32 i;
 
        bss_list = wl->bss_list;
+       /*
        if (unlikely(bss_list->version != WL_BSS_INFO_VERSION)) {
-               WL_ERR(("Version %d != WL_BSS_INFO_VERSION\n",
-                       bss_list->version));
+               WL_ERR(("Version %d != %d\n",
+                       bss_list->version, WL_BSS_INFO_VERSION));
                return -EOPNOTSUPP;
        }
+       */
        WL_DBG(("scanned AP count (%d)\n", bss_list->count));
        bi = next_bss(bss_list, bi);
        for_each_bss(bss_list, bi, i) {
@@ -3712,7 +3714,7 @@ wl_notify_connect_status(struct wl_priv *wl, struct net_device *ndev,
                        if (test_bit(WL_STATUS_CONNECTING, &wl->status))
                                wl_bss_connect_done(wl, ndev, e, data, false);
                } else {
-                       printk("nothing");
+                       printk("%s nothing\n", __FUNCTION__);
                }
                printk("\n");
        }