am f88f1b9f: wl1271: Fix memory corruption in parameters processing

Merge commit 'f88f1b9f38f910dbb6102a1b3de2360095e4e745'

* commit 'f88f1b9f38f910dbb6102a1b3de2360095e4e745':
  wl1271: Fix memory corruption in parameters processing
diff --git a/wl1271/CUDK/configurationutility/Android.mk b/wl1271/CUDK/configurationutility/Android.mk
index 0809fff..6393ba5 100644
--- a/wl1271/CUDK/configurationutility/Android.mk
+++ b/wl1271/CUDK/configurationutility/Android.mk
@@ -49,6 +49,10 @@
 	DK_DEFINES += -D WPA_ENTERPRISE
 endif
 
+ifeq ($(WPA_SUPPLICANT_VERSION),VER_0_6_X)
+	DK_DEFINES += -DSUPPL_WPS_SUPPORT
+endif
+
 #DK_DEFINES += -D NO_WPA_SUPPL
 
 #Supplicant image building
diff --git a/wl1271/CUDK/configurationutility/src/wpa_core.c b/wl1271/CUDK/configurationutility/src/wpa_core.c
index d008ca2..f771625 100644
--- a/wl1271/CUDK/configurationutility/src/wpa_core.c
+++ b/wl1271/CUDK/configurationutility/src/wpa_core.c
@@ -416,18 +416,34 @@
 S32 WpaCore_StartWpsPIN(THandle hWpaCore)
 {
 	TWpaCore* pWpaCore = (TWpaCore*)hWpaCore;
+#ifdef SUPPL_WPS_SUPPORT
+	S8 cmd[100];
+#endif
 
 	pWpaCore->WpaSupplParams.WscMode = WSC_MODE_PIN;
-	
+
+#ifdef SUPPL_WPS_SUPPORT
+	os_sprintf(cmd, "WPS_PIN any");
+	IpcWpa_Command(pWpaCore->hIpcWpa, cmd, TRUE);
+#endif
+
 	return OK;
 }
 
 S32 WpaCore_StartWpsPBC(THandle hWpaCore)
 {
 	TWpaCore* pWpaCore = (TWpaCore*)hWpaCore;
-	
+#ifdef SUPPL_WPS_SUPPORT
+	S8 cmd[100];
+#endif
+
 	pWpaCore->WpaSupplParams.WscMode = WSC_MODE_PBC;
-	
+
+#ifdef SUPPL_WPS_SUPPORT
+	os_sprintf(cmd, "WPS_PBC");
+	IpcWpa_Command(pWpaCore->hIpcWpa, cmd, TRUE);
+#endif
+
 	return OK;
 }
 
diff --git a/wl1271/TWD/Data_Service/RxQueue.c b/wl1271/TWD/Data_Service/RxQueue.c
index 67989a8..ec5ce9b 100644
--- a/wl1271/TWD/Data_Service/RxQueue.c
+++ b/wl1271/TWD/Data_Service/RxQueue.c
@@ -964,7 +964,7 @@
 
     }
 
-    TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR, "RxQueue_ReceivePacket: unknow type tag. tag = %d\n", pRxParams->packet_class_tag);
+    TRACE1(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: unknow type tag. tag = %d\n", pRxParams->packet_class_tag);
 
     RxQueue_PassPacket (pRxQueue, tStatus, pBuffer);
 
diff --git a/wl1271/TWD/FW_Transfer/HwInit.c b/wl1271/TWD/FW_Transfer/HwInit.c
index 8e7b3dc..addca88 100644
--- a/wl1271/TWD/FW_Transfer/HwInit.c
+++ b/wl1271/TWD/FW_Transfer/HwInit.c
@@ -740,7 +740,7 @@
         /* Then, move it 4 places to the right, to alter Fref relevant bits in register 0x2c */
         clkVal = pHwInit->aHwInitTxn[pHwInit->uTxnIndex].uData;
         pHwInit->uTxnIndex = 0; /* Reset index only after getting the last read value! */
-        clkVal |= (pGenParams->RefClk << 1) << 4;
+        clkVal |= ((pGenParams->RefClk & 0x3)<< 1) << 4;
         if ((pGenParams->GeneralSettings & DRPw_MASK_CHECK) > 0)
         {
             clkVal |= DRPw_MASK_SET;
diff --git a/wl1271/config/Android.mk b/wl1271/config/Android.mk
index faa351d..8ebdfb2 100644
--- a/wl1271/config/Android.mk
+++ b/wl1271/config/Android.mk
@@ -18,16 +18,6 @@
 ########################
 
 include $(CLEAR_VARS)
-LOCAL_MODULE := wpa_supplicant.conf
-LOCAL_MODULE_TAGS := user
-LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/wifi
-LOCAL_SRC_FILES := $(LOCAL_MODULE)
-include $(BUILD_PREBUILT)
-
-########################
-
-include $(CLEAR_VARS)
 LOCAL_MODULE := tiwlan.ini
 LOCAL_MODULE_TAGS := user
 LOCAL_MODULE_CLASS := ETC
@@ -46,3 +36,12 @@
 include $(BUILD_PREBUILT)
 
 ########################
+
+WIFI_DRIVER_SOCKET_IFACE := tiwlan0
+ifeq ($(strip $(WPA_SUPPLICANT_VERSION)),VER_0_6_X)
+  include external/wpa_supplicant_6/wpa_supplicant/wpa_supplicant_conf.mk
+else
+  include external/wpa_supplicant/wpa_supplicant_conf.mk
+endif
+
+########################
diff --git a/wl1271/config/tiwlan.ini b/wl1271/config/tiwlan.ini
index 87bfbff..f959d86 100644
--- a/wl1271/config/tiwlan.ini
+++ b/wl1271/config/tiwlan.ini
@@ -28,7 +28,7 @@
 AutoPowerModeDozeMode = 3       #2 - Short Doze
                                 #3 - Long Doze
 
-AutoPowerModeActiveTh = 8       #packets per second (default 15)
+AutoPowerModeActiveTh = 2       #packets per second (default 15)
 
 AutoPowerModeDozeTh = 4         #packets per seconds - threshold for entering ELP in Auto mode (default 8)
 
@@ -120,7 +120,10 @@
 #   Byte #6: Console
 #############################################################
 
-ReportSeverityTable = 00001101
+# LAUNCH Logging Mask
+ReportSeverityTable = 0000000
+# Default Logging Mask
+# ReportSeverityTable = 0001101
 
 BeaconReceiveTime = 50
 
@@ -204,7 +207,7 @@
 ##############################################################################################################################
 
 ################################ General parameters ################################
-STRFRefClock = 1                # Unit: Options 5'bXX000 : Bit 0,1,2 - (0: 19.2MHz; 1: 26MHz; 2: 38.4MHz  (Default); 3: 52MHz;  4: 38.4MHz XTAL) ;
+STRFRefClock = 9                # Unit: Options 5'bXX000 : Bit 0,1,2 - (0: 19.2MHz; 1: 26MHz; 2: 38.4MHz  (Default); 3: 52MHz;  4: 38.4MHz XTAL) ;
                                 # 5'bX0XXX : Bit 3 - CLK_REQ type;  0 = wired-OR (Default) , 1= push-pull
                                 # 5'b0XXXX : Bit 4 - CLK_REQ polarity; 0 = Normal (Default) , 1=Inverted, Format: Unsigned, Source: Customer
 STRFRefClockSettingTime = 5
@@ -218,7 +221,7 @@
                                 # Bit6: LPD Low band, Bit7: LPD High band
 
 # Smart Reflex params
-SRState = 1                                 # Unit: Options ( 1 - Enabled     0- Disabled) Format: Decimal, Source: TI
+SRState = 0                                 # Unit: Options ( 1 - Enabled     0- Disabled) Format: Decimal, Source: TI
 SRF1 = 07,03,18,10,05,fb,f0,e8, 0,0,0,0,0,0,0f,3f  # Unit: SRF1 values, Format: Signed, Source: TI
 SRF2 = 07,03,18,10,05,f6,f0,e8              # Unit: SRF2 values, Format: Signed, Source: TI
 SRF3 = 07,03,18,10,05,fb,f0,e8              # Unit: SRF3 values, Format: Signed, Source: TI
diff --git a/wl1271/config/wpa_supplicant.conf b/wl1271/config/wpa_supplicant.conf
deleted file mode 100644
index 638a61e..0000000
--- a/wl1271/config/wpa_supplicant.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-##### wpa_supplicant configuration file template #####
-update_config=1
-ctrl_interface=tiwlan0
-eapol_version=1
-ap_scan=1
-fast_reauth=1
diff --git a/wl1271/external_drivers/sdio/linux/SdioDrv.c b/wl1271/external_drivers/sdio/linux/SdioDrv.c
index 8797d4e..171c0a6 100644
--- a/wl1271/external_drivers/sdio/linux/SdioDrv.c
+++ b/wl1271/external_drivers/sdio/linux/SdioDrv.c
@@ -243,6 +243,8 @@
 	size_t dma_write_size;
 	struct workqueue_struct *sdio_wq; /* Work Queue */
 	struct work_struct sdiodrv_work;
+	struct timer_list inact_timer;
+	int inact_timer_running;
 } OMAP3430_sdiodrv_t;
 
 struct omap_hsmmc_regs {
@@ -280,6 +282,7 @@
 static void sdioDrv_hsmmc_save_ctx(void);
 static void sdioDrv_hsmmc_restore_ctx(void);
 static void sdiodrv_dma_shutdown(void);
+static void sdioDrv_inact_timer(unsigned long);
 
 #ifndef TI_SDIO_STANDALONE
 void sdio_init( int sdcnum )
@@ -329,6 +332,26 @@
         OMAP_HSMMC_WRITE(HCTL, OMAP_HSMMC_READ(HCTL) | SDBP);
 }
 
+static void sdioDrv_inact_timer(unsigned long data)
+{
+	sdioDrv_clk_disable();
+	g_drv.inact_timer_running = 0;
+}
+
+void sdioDrv_start_inact_timer(void)
+{
+	mod_timer(&g_drv.inact_timer, jiffies + msecs_to_jiffies(1000));
+	g_drv.inact_timer_running = 1;
+}
+
+void sdioDrv_cancel_inact_timer(void)
+{
+	if(g_drv.inact_timer_running) {
+		del_timer_sync(&g_drv.inact_timer);
+		g_drv.inact_timer_running = 0;
+	}
+}
+
 void sdiodrv_task(struct work_struct *unused)
 {
 	PDEBUG("sdiodrv_tasklet()\n");
@@ -547,6 +570,8 @@
 
 static void sdiodrv_free_resources(void)
 {
+	sdioDrv_cancel_inact_timer();
+
 	if(g_drv.ifclks_enabled) {
 		sdioDrv_clk_disable();
 	}
@@ -569,8 +594,71 @@
 
 int sdioDrv_InitHw(void)
 {
+	int rc;
+	u32 status;
+#ifdef SDIO_1_BIT /* see also in SdioAdapter.c */
+	unsigned long clock_rate = 6000000;
+#else
+	unsigned long clock_rate = 24000000;
+#endif
+
+	printk(KERN_INFO "TIWLAN SDIO sdioDrv_InitHw()!!");
+
+        rc = sdioDrv_clk_enable();
+	if (rc) {
+		PERR("sdioDrv_InitHw : sdioDrv_clk_enable FAILED !!!\n");
+		goto err;
+	}
+
+	OMAP3430_mmc_reset();
+
+	//obc - init sequence p. 3600,3617
+	/* 1.8V */
+	OMAP_HSMMC_WRITE(CAPA, OMAP_HSMMC_READ(CAPA) | VS18);
+	OMAP_HSMMC_WRITE(HCTL, OMAP_HSMMC_READ(HCTL) | SDVS18);//SDVS fits p. 3650
+	/* clock gating */
+	OMAP_HSMMC_WRITE(SYSCONFIG, OMAP_HSMMC_READ(SYSCONFIG) | AUTOIDLE);
+
+	/* bus power */
+	OMAP_HSMMC_WRITE(HCTL, OMAP_HSMMC_READ(HCTL) | SDBP);//SDBP fits p. 3650
+	/* interrupts */
+	OMAP_HSMMC_WRITE(ISE, 0);
+	OMAP_HSMMC_WRITE(IE, IE_EN_MASK);
+
+	//p. 3601 suggests moving to the end
+	OMAP3430_mmc_set_clock(clock_rate, &g_drv);
+	printk("SDIO clock Configuration is now set to %dMhz\n",(int)clock_rate/1000000);
+
+	/* Bus width */
+#ifdef SDIO_1_BIT /* see also in SdioAdapter.c */
+	PDEBUG("%s() setting %d data lines\n",__FUNCTION__, 1);
+	OMAP_HSMMC_WRITE(HCTL, OMAP_HSMMC_READ(HCTL) & (ONE_BIT));
+#else
+	PDEBUG("%s() setting %d data lines\n",__FUNCTION__, 4);
+	OMAP_HSMMC_WRITE(HCTL, OMAP_HSMMC_READ(HCTL) | (1 << 1));//DTW 4 bits - p. 3650
+#endif
+
+	/* send the init sequence. 80 clocks of synchronization in the SDIO */
+	//doesn't match p. 3601,3617 - obc
+	OMAP_HSMMC_WRITE( CON, OMAP_HSMMC_READ(CON) | INIT_STREAM);
+	OMAP_HSMMC_SEND_COMMAND( 0, 0);
+	status = sdiodrv_poll_status(OMAP_HSMMC_STAT, CC, MMC_TIMEOUT_MS);
+	if (!(status & CC)) {
+		PERR("sdioDrv_InitHw() SDIO Command error status = 0x%x\n", status);
+		rc = status;
+		goto err;
+	}
+	OMAP_HSMMC_WRITE(CON, OMAP_HSMMC_READ(CON) & ~INIT_STREAM);
+
 	return 0;
-} /* sdioDrv_InitHw */
+
+err:
+	/* Disabling clocks for now */
+	sdioDrv_clk_disable();
+
+	return rc;
+
+} /* sdiodrv_InitHw */
 
 void sdiodrv_shutdown(void)
 {
@@ -1045,12 +1133,6 @@
 static int sdioDrv_probe(struct platform_device *pdev)
 {
 	int rc;
-	u32 status;
-#ifdef SDIO_1_BIT /* see also in SdioAdapter.c */
-	unsigned long clock_rate = 6000000;
-#else
-	unsigned long clock_rate = 24000000;
-#endif
 
 	printk(KERN_INFO "TIWLAN SDIO probe: initializing mmc%d device\n", pdev->id + 1);
 
@@ -1062,7 +1144,7 @@
 
         rc= request_irq(OMAP_MMC_IRQ, sdiodrv_irq, 0, SDIO_DRIVER_NAME, &g_drv);
         if (rc != 0) {
-                PERR("sdioDrv_InitHw() - request_irq FAILED!!\n");
+                PERR("sdioDrv_probe() - request_irq FAILED!!\n");
                 return rc;
         }
         sdiodrv_irq_requested = 1;
@@ -1095,54 +1177,25 @@
 	}
 	sdiodrv_iclk_got = 1;
 	
-        rc = sdioDrv_clk_enable();
-        if (rc) {
-                PERR("sdioDrv_probe : clk_enable FAILED !!!\n");
-                goto err;
+	printk("Configuring SDIO DMA registers!!!\n");
+	printk("pdev->id is %d!!!\n", pdev->id);
+	if ( pdev->id == 1 ) {
+		/* MMC2 */
+		TIWLAN_MMC_CONTROLLER_BASE_ADDR = OMAP_HSMMC2_BASE;
+		TIWLAN_MMC_DMA_TX = OMAP24XX_DMA_MMC2_TX;
+		TIWLAN_MMC_DMA_RX = OMAP24XX_DMA_MMC2_RX;
         }
-
-	OMAP3430_mmc_reset();
-
-	//obc - init sequence p. 3600,3617
-	/* 1.8V */
-	OMAP_HSMMC_WRITE(CAPA,		OMAP_HSMMC_READ(CAPA) | VS18);
-	OMAP_HSMMC_WRITE(HCTL,		OMAP_HSMMC_READ(HCTL) | SDVS18);//SDVS fits p. 3650
-	/* clock gating */
-	OMAP_HSMMC_WRITE(SYSCONFIG, OMAP_HSMMC_READ(SYSCONFIG) | AUTOIDLE);
-
-	/* bus power */
-	OMAP_HSMMC_WRITE(HCTL,		OMAP_HSMMC_READ(HCTL) | SDBP);//SDBP fits p. 3650
-	/* interrupts */
-	OMAP_HSMMC_WRITE(ISE,		0);
-	OMAP_HSMMC_WRITE(IE,		IE_EN_MASK);
-
-	//p. 3601 suggests moving to the end
-	OMAP3430_mmc_set_clock(clock_rate, &g_drv);
-	printk(KERN_INFO "SDIO clock Configuration is now set to %dMhz\n",(int)clock_rate/1000000);
-
-	/* Bus width */
-#ifdef SDIO_1_BIT /* see also in SdioAdapter.c */
-	PDEBUG("%s() setting %d data lines\n",__FUNCTION__, 1);
-	OMAP_HSMMC_WRITE(HCTL, OMAP_HSMMC_READ(HCTL) & (ONE_BIT));
-#else
-	PDEBUG("%s() setting %d data lines\n",__FUNCTION__, 4);
-	OMAP_HSMMC_WRITE(HCTL, OMAP_HSMMC_READ(HCTL) | (1 << 1));//DTW 4 bits - p. 3650
-#endif
-	
-	/* send the init sequence. 80 clocks of synchronization in the SDIO */
-	//doesn't match p. 3601,3617 - obc
-	OMAP_HSMMC_WRITE( CON, OMAP_HSMMC_READ(CON) | INIT_STREAM);
-	OMAP_HSMMC_SEND_COMMAND( 0, 0);
-	status = sdiodrv_poll_status(OMAP_HSMMC_STAT, CC, MMC_TIMEOUT_MS);
-	if (!(status & CC)) {
-		PERR("sdioDrv_InitHw() SDIO Command error status = 0x%x\n", status);
-		rc = -1;
-		goto err;
+	else if ( pdev->id == 2 ) {
+		/* MMC3 */
+		TIWLAN_MMC_CONTROLLER_BASE_ADDR	= OMAP_HSMMC3_BASE;
+		TIWLAN_MMC_DMA_TX = OMAP34XX_DMA_MMC3_TX;
+		TIWLAN_MMC_DMA_RX = OMAP34XX_DMA_MMC3_RX;
 	}
-	OMAP_HSMMC_WRITE(CON, OMAP_HSMMC_READ(CON) & ~INIT_STREAM);
 
-	/* Disabling clocks for now */
-	sdioDrv_clk_disable();
+	/* inactivity timer initialization*/
+	init_timer(&g_drv.inact_timer);
+	g_drv.inact_timer.function = sdioDrv_inact_timer;
+	g_drv.inact_timer_running = 0;
 
 	return 0;
 err:
diff --git a/wl1271/external_drivers/sdio/linux/SdioDrv.h b/wl1271/external_drivers/sdio/linux/SdioDrv.h
index 3383760..3851e3e 100644
--- a/wl1271/external_drivers/sdio/linux/SdioDrv.h
+++ b/wl1271/external_drivers/sdio/linux/SdioDrv.h
@@ -171,5 +171,7 @@
 
 int sdioDrv_clk_enable(void);
 void sdioDrv_clk_disable(void);
+void sdioDrv_start_inact_timer(void);
+void sdioDrv_cancel_inact_timer(void);
 
 #endif/* _OMAP3430_SDIODRV_H */
diff --git a/wl1271/platforms/hw/linux/SdioAdapter.c b/wl1271/platforms/hw/linux/SdioAdapter.c
index aa223ba..9b00e79 100644
--- a/wl1271/platforms/hw/linux/SdioAdapter.c
+++ b/wl1271/platforms/hw/linux/SdioAdapter.c
@@ -537,6 +537,7 @@
 
 	if ((bMore == 1) || (lastMore == bMore))
 	{
+		sdioDrv_cancel_inact_timer();
 		sdioDrv_clk_enable();
 	}
 
@@ -552,7 +553,7 @@
 
 	if (bMore == 0)
 	{
-		sdioDrv_clk_disable();
+		sdioDrv_start_inact_timer();
 	}
 	lastMore = bMore;
 
diff --git a/wl1271/platforms/os/linux/src/CmdInterpretWext.c b/wl1271/platforms/os/linux/src/CmdInterpretWext.c
index 08f6bb2..64e6d41 100644
--- a/wl1271/platforms/os/linux/src/CmdInterpretWext.c
+++ b/wl1271/platforms/os/linux/src/CmdInterpretWext.c
@@ -83,7 +83,8 @@
 } cckm_assocInformation_t;
 
 #define ASSOC_RESP_FIXED_DATA_LEN 6
-#define MAX_BEACON_BODY_LENGTH    350
+/* 1500 is the recommended size by the Motorola Standard team. TI recommendation is 700 */
+#define MAX_BEACON_BODY_LENGTH    1500
 #define BEACON_HEADER_FIX_SIZE    12
 #define CCKM_START_EVENT_SIZE     23 /* cckm-start string + timestamp + bssid + null */
 #endif
diff --git a/wl1271/platforms/os/linux/wl_env.bash b/wl1271/platforms/os/linux/wl_env.bash
index 9bce082..234e0b3 100644
--- a/wl1271/platforms/os/linux/wl_env.bash
+++ b/wl1271/platforms/os/linux/wl_env.bash
@@ -2,5 +2,5 @@
 export CROSS_COMPILE=arm-eabi-
 export ARCH=arm
 export HOST_PLATFORM=sholes
-export KERNEL_DIR=/usr/local/google/android/froyo/kernel
+export KERNEL_DIR=/usr/local/google/android/master/kernel
 
diff --git a/wl1271/stad/build/linux/common.inc b/wl1271/stad/build/linux/common.inc
index feb6ff2..d29e0c1 100644
--- a/wl1271/stad/build/linux/common.inc
+++ b/wl1271/stad/build/linux/common.inc
@@ -126,6 +126,9 @@
    DK_DEFINES += -D TIWLAN_BMTRACE
 endif
 
+# WPS Support
+DK_DEFINES += -D SUPPL_WPS_SUPPORT
+
 ##
 ##
 ## Platform Compilation Directives
diff --git a/wl1271/stad/src/Ctrl_Interface/DrvMain.c b/wl1271/stad/src/Ctrl_Interface/DrvMain.c
index 1838493..3ce112d 100644
--- a/wl1271/stad/src/Ctrl_Interface/DrvMain.c
+++ b/wl1271/stad/src/Ctrl_Interface/DrvMain.c
@@ -1286,7 +1286,6 @@
 {
     TDrvMain         *pDrvMain = (TDrvMain *) hDrvMain;
 
-	pDrvMain->uNumOfRecoveryAttempts++;
     if (!pDrvMain->bRecovery)
     {
         TRACE1(pDrvMain->tStadHandles.hReport, REPORT_SEVERITY_CONSOLE,".....drvMain_Recovery, ts=%d\n", os_timeStampMs(pDrvMain->tStadHandles.hOs));
@@ -1731,6 +1730,7 @@
         }
         else if (pDrvMain->uNumOfRecoveryAttempts < MAX_NUM_OF_RECOVERY_TRIGGERS) 
         {
+            pDrvMain->uNumOfRecoveryAttempts++;
             pDrvMain->eSmState = SM_STATE_STOPPING;
             eStatus = drvMain_StopActivities (pDrvMain);
         }
diff --git a/wl1271/stad/src/Data_link/TrafficMonitor.c b/wl1271/stad/src/Data_link/TrafficMonitor.c
index 501111c..08f7f46 100644
--- a/wl1271/stad/src/Data_link/TrafficMonitor.c
+++ b/wl1271/stad/src/Data_link/TrafficMonitor.c
@@ -1192,9 +1192,11 @@
     {
         pTrafficMonitor->DownTimerEnabled = TI_FALSE;
         tmr_StopTimer (pTrafficMonitor->hTrafficMonTimer);
+        os_wake_unlock(pTrafficMonitor->hOs);
     }
     else if ((downEventsFound > 0) && (pTrafficMonitor->DownTimerEnabled == TI_FALSE))
     {
+        os_wake_lock(pTrafficMonitor->hOs);
         pTrafficMonitor->DownTimerEnabled = TI_TRUE;
         /* Start the timer with user defined percentage of the the minimum interval discovered earlier */
         tmr_StartTimer (pTrafficMonitor->hTrafficMonTimer,
diff --git a/wl1271/stad/src/Data_link/rx.c b/wl1271/stad/src/Data_link/rx.c
index 504387a..c197963 100644
--- a/wl1271/stad/src/Data_link/rx.c
+++ b/wl1271/stad/src/Data_link/rx.c
@@ -985,7 +985,7 @@
         }
 
     default:
-        TRACE0(pRxData->hReport, REPORT_SEVERITY_ERROR, " rxData_receivePacketFromWlan(): Received unspecified packet type !!! \n");
+        TRACE0(pRxData->hReport, REPORT_SEVERITY_INFORMATION, " rxData_receivePacketFromWlan(): Received unspecified packet type !!! \n");
         RxBufFree(pRxData->hOs, pBuffer); 
         break;
     }
diff --git a/wl1271/stad/src/Sta_Management/templates.c b/wl1271/stad/src/Sta_Management/templates.c
index c6d3d36..ec86c61 100644
--- a/wl1271/stad/src/Sta_Management/templates.c
+++ b/wl1271/stad/src/Sta_Management/templates.c
@@ -229,7 +229,9 @@
 	TI_UINT32			 len = 0, ofdmIndex = 0;
 	TI_UINT32			 suppRatesLen, extSuppRatesLen;
 	TI_UINT8			 ratesBuf[DOT11_MAX_SUPPORTED_RATES];
+#ifndef SUPPL_WPS_SUPPORT
 	TI_UINT8             WSCOuiIe[DOT11_OUI_LEN] = { 0x00, 0x50, 0xf2, 0x04};
+#endif
 	TI_UINT32			 supportedRateMask,basicRateMask;	
 	TI_UINT16			 fc = DOT11_FC_PROBE_REQ;
 
@@ -351,6 +353,7 @@
     size += len;
     pBuf += len;
 
+#ifndef SUPPL_WPS_SUPPORT
     /* WiFi Simple Config */
     if (pSiteMgr->includeWSCinProbeReq && (pSiteMgr->siteMgrWSCCurrMode != TIWLN_SIMPLE_CONFIG_OFF))
     {
@@ -365,6 +368,7 @@
         size += sizeof(dot11_eleHdr_t) + pSiteMgr->uWscIeSize + DOT11_OUI_LEN;
         pBuf += sizeof(dot11_eleHdr_t) + pSiteMgr->uWscIeSize + DOT11_OUI_LEN;	
     }
+#endif /* SUPPL_WPS_SUPPORT */
 
 	pTemplate->len = size;
 	
@@ -869,7 +873,3 @@
 
 	return TI_OK;
 }
-
-   
-   
-   
diff --git a/wl1271/utils/802_11Defs.h b/wl1271/utils/802_11Defs.h
index 1895af0..d8109c3 100644
--- a/wl1271/utils/802_11Defs.h
+++ b/wl1271/utils/802_11Defs.h
@@ -345,8 +345,9 @@
 /* mgmt body max length */
 #define MAX_MGMT_BODY_LENGTH                2312
 /* maximal length of beacon body - note that actual beacons may actually be longer
-   than this size, at least according to the spec, but so far no larger beacon was seen */
-#define MAX_BEACON_BODY_LENGTH              350
+   than this size, at least according to the spec, but so far no larger beacon was seen 
+  Note: 1500 is the recommended size by the Motorola Standard team. TI recommendation is 700*/
+#define MAX_BEACON_BODY_LENGTH              1500
 
 /* general mgmt frame structure */
 typedef struct
diff --git a/wl1271/wpa_supplicant_lib/driver_ti.c b/wl1271/wpa_supplicant_lib/driver_ti.c
index d5afff7..0f125e4 100644
--- a/wl1271/wpa_supplicant_lib/driver_ti.c
+++ b/wl1271/wpa_supplicant_lib/driver_ti.c
@@ -299,11 +299,15 @@
 
 	res = wpa_driver_tista_private_send(priv, TIWLN_802_11_START_APP_SCAN_SET, &scanParams, sizeof(scanParams), NULL, 0);
 
-	if (0 != res)
+	if (0 != res) {
 		wpa_printf(MSG_ERROR, "ERROR - Failed to do tista scan!");
-	else
+		if (wpa_s->scanning) {
+			res = 0;
+			wpa_printf(MSG_ERROR, "Ongoing Scan action...");
+		}
+	} else {
 		wpa_printf(MSG_DEBUG, "wpa_driver_tista_scan success");
-
+	}
 	timeout = 30;
 	wpa_printf(MSG_DEBUG, "Scan requested (ret=%d) - scan timeout %d sec",
 			res, timeout);
@@ -326,7 +330,7 @@
 const u8 *wpa_driver_tista_get_mac_addr( void *priv )
 {
 	struct wpa_driver_ti_data *drv = (struct wpa_driver_ti_data *)priv;
-	u8 mac[ETH_ALEN];
+	u8 mac[ETH_ALEN] = {0};
 
 	TI_CHECK_DRIVER( drv->driver_is_loaded, NULL );
 	if(0 != wpa_driver_tista_private_send(priv, CTRL_DATA_MAC_ADDRESS, NULL, 0,
@@ -351,6 +355,7 @@
 	struct wpa_driver_ti_data *drv = (struct wpa_driver_ti_data *)priv;
 	TCuCommon_RoamingStatisticsTable buffer;
 
+	os_memset(&buffer, 0, sizeof(TCuCommon_RoamingStatisticsTable));
 	*rssi_data = 0;
 	*rssi_beacon = 0;
 	if (wpa_driver_tista_get_bssid(priv, bssid) == 0 &&
@@ -444,7 +449,7 @@
 static int wpa_driver_tista_get_bt_coe_status(void *priv, u32 *mode)
 {
 	struct wpa_driver_ti_data *drv = (struct wpa_driver_ti_data *)priv;
-	u32 mode_get;
+	u32 mode_get = 0;
 
 	if(0 != wpa_driver_tista_private_send(priv, SOFT_GEMINI_GET_CONFIG, NULL, 0,
 		&mode_get, sizeof(u32)))
@@ -577,6 +582,17 @@
 	return res;
 }
 
+static int get_num_of_channels(char *country)
+{
+	int channels = NUMBER_SCAN_CHANNELS_FCC;
+
+	if (os_strcasecmp(country, "EU"))
+		channels = NUMBER_SCAN_CHANNELS_ETSI;
+	else if (os_strcasecmp(country, "JP"))
+		channels = NUMBER_SCAN_CHANNELS_MKK1;
+	return channels;
+}
+
 /*-----------------------------------------------------------------------------
 Routine Name: wpa_driver_tista_driver_cmd
 Routine Description: executes driver-specific commands
@@ -656,6 +672,11 @@
 		ret = sprintf(buf,"LinkSpeed %u\n", drv->link_speed);
 		wpa_printf(MSG_DEBUG, "buf %s", buf);
 	}
+	else if( os_strncasecmp(cmd, "country", 7) == 0 ) {
+		drv->scan_channels = get_num_of_channels(cmd + 8);
+		ret = sprintf(buf,"Scan-Channels = %d\n", drv->scan_channels);
+		wpa_printf(MSG_DEBUG, "buf %s", buf);
+	}
 	else if( os_strncasecmp(cmd, "scan-channels", 13) == 0 ) {
 		int noOfChan;
 
@@ -736,6 +757,7 @@
 		u32 mode;
 		TPowerMgr_PowerMode tMode;
 
+		os_memset(&tMode, 0, sizeof(TPowerMgr_PowerMode));
 		ret = wpa_driver_tista_config_power_management( priv, &tMode, 0 );
 		if( ret == 0 ) {
 			ret = sprintf(buf, "powermode = %u\n", tMode.PowerMode);
@@ -774,6 +796,7 @@
 		TCuCommon_RxDataFilteringStatistics stats;
 		int len, i;
 
+		os_memset(&stats, 0, sizeof(TCuCommon_RxDataFilteringStatistics));
 		wpa_printf(MSG_DEBUG,"Rx Data Filter Statistics command");
 		ret = wpa_driver_tista_driver_rx_data_filter_statistics( priv, &stats );
 		if( ret == 0 ) {
@@ -1401,6 +1424,7 @@
 	.scan = wpa_driver_tista_scan,
 #ifdef WPA_SUPPLICANT_VER_0_6_X
 	.get_scan_results2 = wpa_driver_tista_get_scan_results,
+	.combo_scan = NULL,
 #else
 	.get_scan_results = wpa_driver_tista_get_scan_results,
 #endif