diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-01-20 14:04:01 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-01-20 14:04:01 -0800 |
commit | 40425b002260b0b7e21abd7f10e07f42cc2c88e4 (patch) | |
tree | 6d0599dc243039058d7d5b56bd5277a7a9ddbc29 /sta_dk_4_0_4_32/pform/linux | |
parent | 24f0be0e9a23b41683dea619ead9739615c83fac (diff) | |
download | ti-40425b002260b0b7e21abd7f10e07f42cc2c88e4.tar.gz |
auto import from //branches/cupcake/...@127101
Diffstat (limited to 'sta_dk_4_0_4_32/pform/linux')
-rwxr-xr-x | sta_dk_4_0_4_32/pform/linux/src/chip_stat.c | 176 | ||||
-rw-r--r-- | sta_dk_4_0_4_32/pform/linux/src/esta_drv.c | 148 | ||||
-rw-r--r-- | sta_dk_4_0_4_32/pform/linux/src/osapi.c | 9 | ||||
-rw-r--r-- | sta_dk_4_0_4_32/pform/linux/src/osmemapi.c | 25 |
4 files changed, 269 insertions, 89 deletions
diff --git a/sta_dk_4_0_4_32/pform/linux/src/chip_stat.c b/sta_dk_4_0_4_32/pform/linux/src/chip_stat.c new file mode 100755 index 0000000..531c055 --- /dev/null +++ b/sta_dk_4_0_4_32/pform/linux/src/chip_stat.c @@ -0,0 +1,176 @@ +/**************************************************************************** +**+-----------------------------------------------------------------------+** +**| |** +**| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved. |** +**| All rights reserved. |** +**| |** +**| Redistribution and use in source and binary forms, with or without |** +**| modification, are permitted provided that the following conditions |** +**| are met: |** +**| |** +**| * Redistributions of source code must retain the above copyright |** +**| notice, this list of conditions and the following disclaimer. |** +**| * Redistributions in binary form must reproduce the above copyright |** +**| notice, this list of conditions and the following disclaimer in |** +**| the documentation and/or other materials provided with the |** +**| distribution. |** +**| * Neither the name Texas Instruments nor the names of its |** +**| contributors may be used to endorse or promote products derived |** +**| from this software without specific prior written permission. |** +**| |** +**| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |** +**| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |** +**| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |** +**| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |** +**| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |** +**| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |** +**| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |** +**| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |** +**| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |** +**| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |** +**| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |** +**| |** +**+-----------------------------------------------------------------------+** +****************************************************************************/ + +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/version.h> + +#include "mmc_tnetw1150_api.h" +#include "esta_drv.h" +#include "srcApi.h" +#include "osApi.h" +#include "whalHwRegs.h" + +#include "tiwlnif.h" +#include "osUtil.h" + +#ifdef TIWLAN_MSM7000 +struct sdio_func *SDIO_GetFunc( void ); +#endif + +/* Module parameters */ +static char tiwlan_chip_id[10] = "na"; +module_param_string(chip_id, tiwlan_chip_id, sizeof(tiwlan_chip_id), S_IWUSR | S_IRUGO); +MODULE_PARM_DESC(tiwlan_chip_id, "WiFi chip id"); +static char fw_version[10] = "na"; +module_param_string(fw_version, fw_version, sizeof(fw_version), S_IWUSR | S_IRUGO); +MODULE_PARM_DESC(fw_version, "WiFi firmware version"); + +/* export_wifi_fw_version + Exports WiFi firmware version to /sys/module/wlan/parameters/fw_version + Returns 0 if OK +*/ +int export_wifi_fw_version( tiwlan_net_dev_t *drv ) +{ + TIWLN_VERSION swVer; + unsigned long swLen; + int ret; + + if (!drv) + return -EINVAL; + + swLen = sizeof(swVer); + memset(&swVer, 0, swLen); + ret = UtilGetSwVersion(&drv->adapter, (unsigned char *)&swVer, &swLen); + if (ret != 0) + return -EINVAL; + + fw_version[0] = swVer.FWVersion.major + 48; + fw_version[1] = '.'; + fw_version[2] = swVer.FWVersion.minor + 48; + fw_version[3] = '.'; + fw_version[4] = swVer.FWVersion.bugfix + 48; + fw_version[5] = '.'; + fw_version[6] = swVer.FWVersion.subld + 48; + fw_version[7] = '.'; + fw_version[8] = swVer.FWVersion.build + 48; + fw_version[9] = '\0'; + return ret; +} + +/* print_wifi_chip_id + Reads WiFi chip id (0x07030101) and prints it + Returns 0 if OK +*/ +int export_wifi_chip_id( void ) +{ + unsigned char chip_id[4]; + unsigned long amap; +#ifdef TIWLAN_MSM7000 + SDIO_Request_t req; + struct sdio_func *func; + + func = SDIO_GetFunc(); + if (!func) + return -EINVAL; + + /* configure partition */ + amap = SDIO_DOWNLOAD_PARTITION_START; + req.buffer = (unsigned char *)&amap; + req.buffer_len = 4; + req.peripheral_addr = 0x1ffc4; + SDIO_SyncWrite(func, &req); + + amap = SDIO_DOWNLOAD_PARTITION_SIZE; + req.buffer = (unsigned char *)&amap; + req.buffer_len = 4; + req.peripheral_addr = 0x1ffc0; + SDIO_SyncWrite(func, &req); + + amap = SDIO_REG_PARTITION_START; + req.buffer = (unsigned char *)&amap; + req.buffer_len = 4; + req.peripheral_addr = 0x1ffcc; + SDIO_SyncWrite(func, &req); + + amap = SDIO_REG_PARTITION_SIZE; + req.buffer = (unsigned char *)&amap; + req.buffer_len = 4; + req.peripheral_addr = 0x1ffc8; + SDIO_SyncWrite(func, &req); + + /* get TIWLAN1251 ID */ + memset(chip_id, 0, 4); + req.buffer = chip_id; + req.buffer_len = 4; + req.peripheral_addr = SDIO_DOWNLOAD_PARTITION_SIZE + CHIP_ID; /* 0x1BE74 */ + SDIO_SyncRead(func, &req); +#endif +#ifdef TIWLAN_OMAP1610 + /* Can not be read on this stage - SDIO stack is not initialized yet */ + amap = TNETW1251_CHIP_ID_PG1_2; + memcpy(chip_id, &amap, 4); +#endif + + if ((chip_id[2] >= 1) && (chip_id[2] <= 3)){ + tiwlan_chip_id[0] = '1'; + tiwlan_chip_id[1] = '2'; + tiwlan_chip_id[2] = '5'; + tiwlan_chip_id[3] = '1'; + tiwlan_chip_id[4] = 'P'; + tiwlan_chip_id[5] = 'G'; + tiwlan_chip_id[6] = '1'; + tiwlan_chip_id[7] = '.'; + } + switch(chip_id[2]){ + case 1: + tiwlan_chip_id[8] = '0'; + printk("TIWLAN: 1251 PG 1.0\n"); + break; + case 2: + tiwlan_chip_id[8] = '1'; + printk("TIWLAN: 1251 PG 1.1\n"); + break; + case 3: + tiwlan_chip_id[8] = '2'; + printk("TIWLAN: 1251 PG 1.2\n"); + break; + default: + printk("TIWLAN: invalid chip id = 0x%2x%2x%2x%2x!\n", + chip_id[3], chip_id[2], chip_id[1], chip_id[0]); + return -EINVAL; + }; + return 0; +} diff --git a/sta_dk_4_0_4_32/pform/linux/src/esta_drv.c b/sta_dk_4_0_4_32/pform/linux/src/esta_drv.c index a550292..90d022e 100644 --- a/sta_dk_4_0_4_32/pform/linux/src/esta_drv.c +++ b/sta_dk_4_0_4_32/pform/linux/src/esta_drv.c @@ -33,7 +33,6 @@ **+-----------------------------------------------------------------------+** ****************************************************************************/ - #include <linux/module.h> #include <linux/kernel.h> #include <linux/version.h> @@ -110,7 +109,6 @@ #define RX_RATE_INTERVAL_SEC 10 unsigned long num_rx_pkt_new = 0; static unsigned long num_rx_pkt_last = 0; -static unsigned silent_count = 0; #endif #ifdef TIWLAN_MSM7000 @@ -123,6 +121,10 @@ static struct wifi_platform_data *wifi_control_data = NULL; #endif #endif +/* WiFi chip information functions */ +int export_wifi_fw_version( tiwlan_net_dev_t *drv ); +int export_wifi_chip_id( void ); + /* Drivers list */ static LIST_HEAD(tiwlan_drv_list); @@ -150,13 +152,12 @@ static int tiwlan_drv_net_stop(struct net_device * dev); static int tiwlan_drv_net_xmit(struct sk_buff * skb, struct net_device * dev); static struct net_device_stats * tiwlan_drv_net_get_stats(struct net_device * dev); - #define OS_WRITE_REG(drv,reg,val) \ os_hwWriteMemRegisterUINT32(drv, (UINT32 *)((unsigned long)drv->acx_reg.va + reg), (__u32)(val)) #define OS_READ_REG(drv,reg,val) \ os_hwReadMemRegisterUINT32(drv, (UINT32 *)((unsigned long)drv->acx_reg.va + reg), &val) - + #ifdef TIWLAN_OMAP1610 static void omap_memif_init(void) { @@ -811,12 +812,12 @@ static irqreturn_t tiwlan_interrupt (int irq, void *netdrv, struct pt_regs *cpu_ { configMgr_disableInterrupts(drv->adapter.CoreHalCtx); drv->interrupt_pending = 1; - tasklet_schedule (&drv->tl); + tasklet_schedule (&drv->tl); } else { #if DEBUG_UNKNOWN_INTERRUPT - ti_dprintf (TIWLAN_LOG_ERROR, + ti_dprintf (TIWLAN_LOG_ERROR, "%s - ERROR - interrupt isn't TNET interrupt! interrupt vector = 0x%08X\n", __FUNCTION__, interruptVector); #endif @@ -831,7 +832,7 @@ static irqreturn_t tiwlan_interrupt (int irq, void *netdrv, struct pt_regs *cpu_ { tiwlan_net_dev_t *drv = (tiwlan_net_dev_t *)netdrv; - drv->interrupt_pending = 1; + drv->interrupt_pending = 1; /* printk("TI: %s:\t%lu\n", __FUNCTION__, jiffies); */ #ifdef DM_USE_WORKQUEUE if( queue_work( drv->tiwlan_wq, &drv->tirq ) != 0 ) { @@ -841,7 +842,7 @@ static irqreturn_t tiwlan_interrupt (int irq, void *netdrv, struct pt_regs *cpu_ } /* disable_irq( drv->irq ); Dm: No need, we can loose IRQ */ #else - tasklet_schedule( &drv->tl ); + tasklet_schedule( &drv->tl ); #endif return IRQ_HANDLED; } @@ -868,7 +869,7 @@ static void tiwlan_handle_control_requests( tiwlan_net_dev_t *drv ) tiwlan_req_t *req = list_entry(entry, tiwlan_req_t, list); tiwlan_req_t tmp_req; unsigned long flags; - + spin_lock_irqsave(&drv->lock, flags); list_del_init(entry); spin_unlock_irqrestore(&drv->lock, flags); @@ -902,7 +903,7 @@ static void tiwlan_handle_control_requests( tiwlan_net_dev_t *drv ) bm_trace(5, 0, 0); - /* DbgCB_Insert(0, DBG_MODULE_OS, DBG_TYPE_TASKLET, 1)*/ + /* DbgCB_Insert(0, DBG_MODULE_OS, DBG_TYPE_TASKLET, 1)*/ } #ifdef DM_USE_WORKQUEUE @@ -910,7 +911,7 @@ static void tiwlan_irq_handler( struct work_struct *work ) { tiwlan_net_dev_t *drv = (tiwlan_net_dev_t *)container_of( work, struct tiwlan_net_dev, tirq ); - /* if the driver was unloaded by that time we need to ignore all the timers */ + /* if the driver was unloaded by that time we need to ignore all the timers */ if (drv->unload_driver) { #ifdef CONFIG_ANDROID_POWER android_unlock_suspend( &drv->irq_wake_lock ); @@ -954,7 +955,7 @@ static void tiwlan_tasklet_handler( unsigned long netdrv ) static unsigned int maximum_stack = 0; #endif - /* if the driver was unloaded by that time we need to ignore all the timers */ + /* if the driver was unloaded by that time we need to ignore all the timers */ if (drv->unload_driver) { #ifdef CONFIG_ANDROID_POWER android_unlock_suspend( &drv->timer_wake_lock ); @@ -968,27 +969,27 @@ static void tiwlan_tasklet_handler( unsigned long netdrv ) #ifdef DRIVER_PROFILE os_profile (drv, 0, 0); -#endif +#endif bm_trace(3, 0, 0); #ifdef STACK_PROFILE curr1 = check_stack_start(&base1); #endif - /* Handle bus transaction interrupts */ - if (drv->dma_done) - { - drv->dma_done = 0; - configMgr_HandleBusTxn_Complete(drv->adapter.CoreHalCtx); - } + /* Handle bus transaction interrupts */ + if (drv->dma_done) + { + drv->dma_done = 0; + configMgr_HandleBusTxn_Complete(drv->adapter.CoreHalCtx); + } - /* don't call for "Handle interrupts, timers, ioctls" while recovery process */ - if (configMgr_areInputsFromOsDisabled(drv->adapter.CoreHalCtx) == TRUE) { + /* don't call for "Handle interrupts, timers, ioctls" while recovery process */ + if (configMgr_areInputsFromOsDisabled(drv->adapter.CoreHalCtx) == TRUE) { #ifdef CONFIG_ANDROID_POWER android_unlock_suspend( &drv->timer_wake_lock ); #endif - return; - } + return; + } /* Handle firmware interrupts */ #ifndef DM_USE_WORKQUEUE @@ -1002,10 +1003,10 @@ static void tiwlan_tasklet_handler( unsigned long netdrv ) tiwlan_handle_control_requests( drv ); #ifdef STACK_PROFILE - curr2 = check_stack_stop(&base2); + curr2 = check_stack_stop(&base2); if (base2 == base1) - { + { /* if the current measurement is bigger then the maximum store it and print*/ if ((curr1 - curr2) > maximum_stack) { @@ -1013,14 +1014,14 @@ static void tiwlan_tasklet_handler( unsigned long netdrv ) printk("current operation stack use =%d \n",(curr1 - curr2)); printk("total stack use=%d \n",8192 - curr2 + base2); printk("total stack usage= %d percent \n",100 * (8192 - curr2 + base2) / 8192); - maximum_stack = curr1 - curr2; + maximum_stack = curr1 - curr2; } } #endif #ifdef DRIVER_PROFILE os_profile (drv, 1, 0); -#endif +#endif #if 0 ti_dprintf(TIWLAN_LOG_INFO, "%s out\n" , __FUNCTION__); @@ -1040,17 +1041,10 @@ static void tiwlan_rx_watchdog(struct work_struct *work) /* Contribute 10mA (200mA x 5%) for 1 pkt/sec, and plus 8mA base. */ unsigned percent = (5 * num_rx_pkts / RX_RATE_INTERVAL_SEC) + PWRSINK_WIFI_PERCENT_BASE; - if (num_rx_pkts == 0 && silent_count < 3) - silent_count++; - else if (num_rx_pkts > 0) - silent_count = 0; - - if (silent_count >= 3) /* WiFi sleep mode. */ - percent = 0; if (drv->unload_driver) return; - + percent = (percent > 100) ? 100 : percent; /* printk(KERN_INFO "num_rx_pkts=%ld, percent=%d\n", num_rx_pkts, percent); */ #ifdef CONFIG_HTC_PWRSINK @@ -1160,7 +1154,7 @@ tiwlan_alloc_drv(unsigned long reg_start, unsigned long reg_size, { static tiwlan_net_dev_t *drv; drv = kmalloc(sizeof(tiwlan_net_dev_t), GFP_KERNEL); -#ifdef TI_MEM_ALLOC_TRACE +#ifdef TI_MEM_ALLOC_TRACE os_printf("MTT:%s:%d ::kmalloc(%lu, %x) : %lu\n", __FUNCTION__, __LINE__, sizeof(tiwlan_net_dev_t), GFP_KERNEL, sizeof(tiwlan_net_dev_t)); #endif/*I_MEM_ALLOC_TRACE*/ @@ -1208,7 +1202,7 @@ int tiwlan_init_drv (tiwlan_net_dev_t *drv, tiwlan_dev_init_t *init_info) init_table = os_memoryAlloc (drv, sizeof(initTable_t)); -#ifdef TI_MEM_ALLOC_TRACE +#ifdef TI_MEM_ALLOC_TRACE osPrintf ("MTT:%s:%d ::kmalloc(%lu, %x) : %lu\n", __FUNCTION__, __LINE__, sizeof(initTable_t), GFP_KERNEL, sizeof(initTable_t)); #endif/*I_MEM_ALLOC_TRACE*/ if (!init_table) @@ -1224,7 +1218,7 @@ int tiwlan_init_drv (tiwlan_net_dev_t *drv, tiwlan_dev_init_t *init_info) { drv->eeprom_image.va = os_memoryAlloc (drv, drv->eeprom_image.size); -#ifdef TI_MEM_ALLOC_TRACE +#ifdef TI_MEM_ALLOC_TRACE osPrintf ("MTT:%s:%d ::kmalloc(%lu, %x) : %lu\n", __FUNCTION__, __LINE__, drv->eeprom_image.size, GFP_KERNEL, drv->eeprom_image.size); #endif if (!drv->eeprom_image.va) @@ -1235,7 +1229,7 @@ int tiwlan_init_drv (tiwlan_net_dev_t *drv, tiwlan_dev_init_t *init_info) } memcpy (drv->eeprom_image.va, &init_info->data[0], drv->eeprom_image.size ); } - + #ifdef FIRMWARE_DYNAMIC_LOAD drv->firmware_image.size = init_info->firmware_image_length; if (!drv->firmware_image.size) @@ -1244,7 +1238,7 @@ int tiwlan_init_drv (tiwlan_net_dev_t *drv, tiwlan_dev_init_t *init_info) return -EINVAL; } drv->firmware_image.va = os_memoryAlloc (drv,drv->firmware_image.size); -#ifdef TI_MEM_ALLOC_TRACE +#ifdef TI_MEM_ALLOC_TRACE osPrintf ("MTT:%s:%d ::kmalloc(%lu, %x) : %lu\n", __FUNCTION__, __LINE__, drv->firmware_image.size, GFP_KERNEL, drv->firmware_image.size); #endif if (!drv->firmware_image.va) @@ -1267,14 +1261,14 @@ int tiwlan_init_drv (tiwlan_net_dev_t *drv, tiwlan_dev_init_t *init_info) #endif } - print_deb ("--------- Eeeprom=%p(%lu), Firmware=%p(%lu)\n", - drv->eeprom_image.va, + print_deb ("--------- Eeeprom=%p(%lu), Firmware=%p(%lu)\n", + drv->eeprom_image.va, drv->eeprom_image.size, - drv->firmware_image.va, + drv->firmware_image.va, drv->firmware_image.size); - + /* Init defaults */ - if ((rc = osInitTable_IniFile (drv, + if ((rc = osInitTable_IniFile (drv, init_table, (init_info && init_info->init_file_length) ? &init_info->data[init_info->eeprom_image_length+init_info->firmware_image_length] : NULL, @@ -1282,8 +1276,8 @@ int tiwlan_init_drv (tiwlan_net_dev_t *drv, tiwlan_dev_init_t *init_info) { ti_dprintf (TIWLAN_LOG_ERROR, "osInitTable_IniFile failed :cannot initialize defaults\n"); os_memoryFree (drv, init_table, sizeof(initTable_t)); - -#ifdef TI_MEM_ALLOC_TRACE + +#ifdef TI_MEM_ALLOC_TRACE os_printf("MTT:%s:%d ::kfree(0x%p) : %d\n", __FUNCTION__, __LINE__, sizeof(initTable_t), -sizeof(initTable_t)); #endif return rc; @@ -1293,10 +1287,10 @@ int tiwlan_init_drv (tiwlan_net_dev_t *drv, tiwlan_dev_init_t *init_info) pWLAN_Images[1] = (void *)drv->firmware_image.size; pWLAN_Images[2] = (void *)drv->eeprom_image.va; pWLAN_Images[3] = (void *)drv->eeprom_image.size; - - drv->adapter.CoreHalCtx = configMgr_create (drv, + + drv->adapter.CoreHalCtx = configMgr_create (drv, pWLAN_Images, - init_table, + init_table, (macAddress_t *) &drv->adapter.CurrentAddr); if (!(drv->adapter.CoreHalCtx)) { @@ -1317,15 +1311,15 @@ int tiwlan_init_drv (tiwlan_net_dev_t *drv, tiwlan_dev_init_t *init_info) #ifndef PRIODIC_INTERRUPT #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) unsigned long flags; - /* - * Disable all interrupts for not to catch the tiwlan irq + /* + * Disable all interrupts for not to catch the tiwlan irq * between request_irq and disable_irq */ spin_lock_irqsave (&(drv->lock), flags); if ((rc = request_irq (drv->irq, tiwlan_interrupt, SA_SHIRQ, drv->netdev->name, drv))) #else if ((rc = request_irq (drv->irq, (irq_handler_t)tiwlan_interrupt, IRQF_SHARED | IRQF_TRIGGER_FALLING /*Dm:*/, drv->netdev->name, drv))) -#endif +#endif { print_err ("TIWLAN: Failed to register interrupt handler\n"); configMgr_stop (drv->adapter.CoreHalCtx); @@ -1338,7 +1332,7 @@ int tiwlan_init_drv (tiwlan_net_dev_t *drv, tiwlan_dev_init_t *init_info) set_irq_wake(drv->irq, 1); #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) - set_irq_type (drv->irq, IRQT_FALLING); + set_irq_type (drv->irq, IRQT_FALLING); #else set_irq_type (drv->irq, IRQ_TYPE_EDGE_FALLING); #endif @@ -1356,14 +1350,14 @@ int tiwlan_init_drv (tiwlan_net_dev_t *drv, tiwlan_dev_init_t *init_info) mod_timer (&drv->poll_timer, jiffies + TIWLAN_IRQ_POLL_INTERVAL); } - /* - * Now that all parts of the driver have been created and handles linked + /* + * Now that all parts of the driver have been created and handles linked * proceed to download the FW code */ - configMgr_init (drv, - drv->adapter.CoreHalCtx, - pWLAN_Images, - init_table, + configMgr_init (drv, + drv->adapter.CoreHalCtx, + pWLAN_Images, + init_table, (macAddress_t *) &drv->adapter.CurrentAddr); /* Wait for the download to complete */ @@ -1372,9 +1366,9 @@ int tiwlan_init_drv (tiwlan_net_dev_t *drv, tiwlan_dev_init_t *init_info) os_memoryFree (drv, init_table, sizeof(initTable_t)); if (rc == OK) - { + { proc_stat_init (drv->adapter.CoreHalCtx); -#ifdef TI_MEM_ALLOC_TRACE +#ifdef TI_MEM_ALLOC_TRACE osPrintf ("MTT:%s:%d ::kfree(0x%p) : %d\n", __FUNCTION__, __LINE__, sizeof(initTable_t), -sizeof(initTable_t)); #endif/*I_MEM_ALLOC_TRACE*/ @@ -1397,7 +1391,7 @@ int tiwlan_init_drv (tiwlan_net_dev_t *drv, tiwlan_dev_init_t *init_info) #endif #else drv->wl_sock = netlink_kernel_create(&init_net, NETLINK_USERSOCK, 0, NULL, NULL, THIS_MODULE); /* Dm: */ -#endif +#endif if (drv->wl_sock == NULL) { ti_dprintf(TIWLAN_LOG_ERROR, "netlink_kernel_create() failed !\n"); @@ -1411,7 +1405,7 @@ int tiwlan_init_drv (tiwlan_net_dev_t *drv, tiwlan_dev_init_t *init_info) drv->netdev->addr_len = MAC_ADDR_LEN; /* Register the relevant events with the event handler */ - tiwlan_register_events (drv); + tiwlan_register_events (drv); /* Mark that init stage has succeded */ drv->initialized = 1; @@ -1471,6 +1465,7 @@ int tiwlan_start_drv(tiwlan_net_dev_t *drv) #ifdef CONFIG_HTC_PWRSINK htc_pwrsink_set(PWRSINK_WIFI, PWRSINK_WIFI_PERCENT_BASE); #endif + export_wifi_fw_version(drv); return 0; } @@ -1675,9 +1670,9 @@ int tiwlan_stop_drv(tiwlan_net_dev_t *drv) if (drv->netdev) netif_stop_queue(drv->netdev); + drv->started = 0; configMgr_stop(drv->adapter.CoreHalCtx); - drv->started = 0; #ifdef CONFIG_TROUT_PWRSINK trout_pwrsink_set(PWRSINK_WIFI, 0); #endif @@ -1704,6 +1699,15 @@ int tiwlan_stop_and_destroy_drv(tiwlan_net_dev_t *drv) return 0; } +void *wifi_kernel_prealloc(int section, unsigned long size) +{ +#ifdef CONFIG_WIFI_CONTROL_FUNC + if( wifi_control_data && wifi_control_data->mem_prealloc ) + return wifi_control_data->mem_prealloc( section, size ); + else +#endif + return NULL; +} #ifdef TIWLAN_CARDBUS @@ -1856,16 +1860,6 @@ static struct sdio_driver tiwlan_sdio_drv = { .id_table = tiwlan_sdio_ids, }; -void *wifi_kernel_prealloc(int section, unsigned long size) -{ -#ifdef CONFIG_WIFI_CONTROL_FUNC - if( wifi_control_data && wifi_control_data->mem_prealloc ) - return wifi_control_data->mem_prealloc( section, size ); - else -#endif - return NULL; -} - #ifdef CONFIG_WIFI_CONTROL_FUNC static int wifi_probe( struct platform_device *pdev ) { @@ -1964,10 +1958,13 @@ static int __init tiwlan_module_init(void) print_err("TIWLAN: PCMCIA driver failed to register\n"); return rc; } + printk(KERN_INFO "TIWLAN: Driver loaded\n"); return 0; #elif defined(TIWLAN_OMAP1610) rc = omap1610_drv_create(); + export_wifi_chip_id(); + printk(KERN_INFO "TIWLAN: Driver loaded\n"); return rc; #elif defined(TIWLAN_MSM7000) @@ -2007,6 +2004,7 @@ static int __init tiwlan_module_init(void) #endif return -ENODEV; } + export_wifi_chip_id(); printk(KERN_INFO "TIWLAN: Driver loaded\n"); return 0; diff --git a/sta_dk_4_0_4_32/pform/linux/src/osapi.c b/sta_dk_4_0_4_32/pform/linux/src/osapi.c index 9763a22..c90e717 100644 --- a/sta_dk_4_0_4_32/pform/linux/src/osapi.c +++ b/sta_dk_4_0_4_32/pform/linux/src/osapi.c @@ -1538,7 +1538,7 @@ os_IndicateEvent(IPC_EV_DATA* pData) /*UCHAR AuthBuf[sizeof(ULONG) + sizeof(OS_802_11_AUTHENTICATION_REQUEST)];*/ ti_nodprintf(TIWLAN_LOG_INFO, "\n os_ConnectionStatus Event 0x%08x \n", CsStatus->Event); - + switch(pInParam->uEventType) { case IPC_EVENT_ASSOCIATED: @@ -1553,11 +1553,14 @@ os_IndicateEvent(IPC_EV_DATA* pData) case IPC_EVENT_DISASSOCIATED: if (drv->netdev != NULL) { #if defined(CONFIG_TROUT_PWRSINK) || defined(CONFIG_HTC_PWRSINK) + unsigned percent; + cancel_delayed_work_sync(&drv->trxw); + percent = ( drv->started ) ? PWRSINK_WIFI_PERCENT_BASE : 0; #ifdef CONFIG_HTC_PWRSINK - htc_pwrsink_set(PWRSINK_WIFI, PWRSINK_WIFI_PERCENT_BASE); + htc_pwrsink_set(PWRSINK_WIFI, percent); #else - trout_pwrsink_set(PWRSINK_WIFI, PWRSINK_WIFI_PERCENT_BASE); + trout_pwrsink_set(PWRSINK_WIFI, percent); #endif #endif netif_carrier_off(drv->netdev); diff --git a/sta_dk_4_0_4_32/pform/linux/src/osmemapi.c b/sta_dk_4_0_4_32/pform/linux/src/osmemapi.c index 18d5620..d22eacb 100644 --- a/sta_dk_4_0_4_32/pform/linux/src/osmemapi.c +++ b/sta_dk_4_0_4_32/pform/linux/src/osmemapi.c @@ -68,12 +68,12 @@ struct os_mem_block /**************************************************************************************** * * - * OS Memory API * + * OS Memory API * * * ****************************************************************************************/ /**************************************************************************************** - * os_memoryAlloc() + * os_memoryAlloc() **************************************************************************************** DESCRIPTION: Allocates resident (nonpaged) system-space memory. @@ -103,14 +103,17 @@ os_memoryAlloc( if( total_size < Size ) { /* Dm: Security fix */ return NULL; } - /* + /* memory optimization issue. Allocate 8 kB and less from the SLAB allocator (2^n) otherwise allocate from virtual pool. */ - /* 2 pages */ - if (Size < 2 * 4096) + /* 2 pages */ + if (Size <= 2 * 4096) { - blk = kmalloc(total_size, GFP_ATOMIC); + if (in_atomic()) + blk = kmalloc(total_size, GFP_ATOMIC); + else + blk = kmalloc(total_size, GFP_KERNEL); if (!blk) return NULL; blk->f_free = (os_free)kfree; @@ -120,7 +123,7 @@ os_memoryAlloc( /* We expect that the big allocations should be made outside the interrupt, otherwise fail */ - if (in_interrupt()) + if (in_atomic()) return NULL; blk = vmalloc(total_size); if (!blk) @@ -138,18 +141,18 @@ os_memoryAlloc( } /**************************************************************************************** - * os_memoryPreFree() + * os_memoryPreFree() **************************************************************************************** DESCRIPTION: Frees preallocated by the kernel memory. -ARGUMENTS: ptr - pointer to memory +ARGUMENTS: ptr - pointer to memory *****************************************************************************************/ void os_memoryPreFree( void *ptr ) { } /**************************************************************************************** - * os_memoryPreAlloc() + * os_memoryPreAlloc() **************************************************************************************** DESCRIPTION: Gets system-space memory preallocated by kernel. @@ -194,7 +197,7 @@ os_memoryPreAlloc( /**************************************************************************************** - * os_memoryCAlloc() + * os_memoryCAlloc() **************************************************************************************** DESCRIPTION: Allocates an array in memory with elements initialized to 0. |