summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sta_dk_4_0_4_32/common/src/core/sme/siteMgr/select.c14
-rw-r--r--sta_dk_4_0_4_32/pform/common/src/osRgstry.c12
-rw-r--r--sta_dk_4_0_4_32/pform/linux/src/esta_drv.c10
-rw-r--r--sta_dk_4_0_4_32/wpa_supplicant_lib/driver_ti.c9
-rw-r--r--wilink_6_1/external_drivers/zoom2/Linux/sdio/Makefile59
-rw-r--r--wilink_6_1/external_drivers/zoom2/Linux/sdio/SdioDrv.c1257
-rw-r--r--wilink_6_1/external_drivers/zoom2/Linux/sdio/SdioDrv.h155
-rw-r--r--wilink_6_1/external_drivers/zoom2/Linux/sdio/SdioDrvDbg.h58
-rw-r--r--wilink_6_1/platforms/hw/host_platform_zoom2/linux/SdioAdapter.c330
-rw-r--r--wilink_6_1/platforms/hw/host_platform_zoom2/linux/SdioAdapter.h143
-rw-r--r--wilink_6_1/platforms/hw/host_platform_zoom2/linux/host_platform.c317
-rw-r--r--wilink_6_1/platforms/hw/host_platform_zoom2/linux/host_platform.h99
-rw-r--r--wilink_6_1/platforms/os/linux/src/WlanDrvWext.c175
-rw-r--r--wilink_6_1/platforms/os/linux/src/osapi.c39
-rw-r--r--wilink_6_1/platforms/os/linux/zoom2_env.bash2
-rw-r--r--wilink_6_1/stad/src/Connection_Managment/admCtrlWpa.c3
-rw-r--r--wilink_6_1/stad/src/Connection_Managment/connInfra.c2
-rw-r--r--wilink_6_1/stad/src/Data_link/rx.c13
-rw-r--r--wilink_6_1/wpa_supplicant_lib/driver_ti.c26
19 files changed, 170 insertions, 2553 deletions
diff --git a/sta_dk_4_0_4_32/common/src/core/sme/siteMgr/select.c b/sta_dk_4_0_4_32/common/src/core/sme/siteMgr/select.c
index 16e444c..57fe2da 100644
--- a/sta_dk_4_0_4_32/common/src/core/sme/siteMgr/select.c
+++ b/sta_dk_4_0_4_32/common/src/core/sme/siteMgr/select.c
@@ -253,19 +253,18 @@ siteEntry_t* siteMgr_selectSiteFromTable(TI_HANDLE hSiteMgr)
UINT32 prevMatchingLevel = 0;
UINT8 siteIndex, tableIndex, numberOfSites = 0;
siteMgr_t *pSiteMgr = (siteMgr_t *)hSiteMgr;
- siteEntry_t *pSiteEntry, *pLastMatchSite = NULL;
+ siteEntry_t *pSiteEntry, *pLastMatchSite = NULL;
rsnData_t rsnData;
- dot11_RSN_t *pRsnIe;
- UINT8 rsnIECount=0;
- UINT8 curRsnData[255];
- UINT8 length=0;
+ dot11_RSN_t *pRsnIe;
+ UINT8 rsnIECount=0;
+ UINT8 length=0;
paramInfo_t param;
- radioBand_e radioBand;
+ radioBand_e radioBand;
BOOL bRegulatoryDomainEnabled;
siteTablesParams_t* currTable = pSiteMgr->pSitesMgmtParams->pCurrentSiteTable;
- WLAN_REPORT_INFORMATION(pSiteMgr->hReport, SITE_MGR_MODULE_LOG,
+ WLAN_REPORT_INFORMATION(pSiteMgr->hReport, SITE_MGR_MODULE_LOG,
("SITE MATCH , Desired ssid (%s) len= (%d)\n\n",
pSiteMgr->pDesiredParams->siteMgrDesiredSSID.ssidString,
pSiteMgr->pDesiredParams->siteMgrDesiredSSID.len));
@@ -1438,4 +1437,3 @@ TI_STATUS systemConfig(siteMgr_t *pSiteMgr)
return OK;
}
-
diff --git a/sta_dk_4_0_4_32/pform/common/src/osRgstry.c b/sta_dk_4_0_4_32/pform/common/src/osRgstry.c
index d625868..5a37e59 100644
--- a/sta_dk_4_0_4_32/pform/common/src/osRgstry.c
+++ b/sta_dk_4_0_4_32/pform/common/src/osRgstry.c
@@ -1041,7 +1041,7 @@ regFillInitTable(
/*defaults values for beacon IE table*/
/*UINT8 defBeaconIETableSize = 0 ;*/
- UINT8 defBeaconIETable[] = "00 01 01 01 32 01 2a 01 03 01 06 01 07 01 20 01 25 01 23 01 30 01 28 01 2e 01 85 01 dd 01 00 52 f2 02 00 01";
+ static UINT8 defBeaconIETable[] = "00 01 01 01 32 01 2a 01 03 01 06 01 07 01 20 01 25 01 23 01 30 01 28 01 2e 01 85 01 dd 01 00 52 f2 02 00 01";
/*UINT8 tmpIeTable[BEACON_FILTER_TABLE_MAX_SIZE] ;*/
UINT8 staBeaconFilterIETable[BEACON_FILTER_STRING_MAX_LEN] ;
UINT8 tmpIeTableSize = 35;
@@ -1056,11 +1056,11 @@ regFillInitTable(
initTable_t* p = (initTable_t*) pInitTable;
USHORT tableLen = 0;
USHORT loopIndex = 0;
- UINT8 ScanControlTable24Tmp[2 * NUM_OF_CHANNELS_24];
- UINT8 ScanControlTable5Tmp[2 * A_5G_BAND_NUM_CHANNELS];
- UINT8 ScanControlTable24Def[2* NUM_OF_CHANNELS_24] = "FFFFFFFFFFFFFFFFFFFFFFFFFFFF";
- UINT8 ScanControlTable5Def[2 * A_5G_BAND_NUM_CHANNELS] = "FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000000000000000000000000000000000000000000000000000000000000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000000000FF000000FF000000FF000000FF00000000000000000000000000000000000000";
- UINT8 reportSeverityTableDefaults[WLAN_MAX_SEVERITIES] = "000000000000";
+ static UINT8 ScanControlTable24Tmp[2 * NUM_OF_CHANNELS_24];
+ static UINT8 ScanControlTable5Tmp[2 * A_5G_BAND_NUM_CHANNELS];
+ static UINT8 ScanControlTable24Def[2* NUM_OF_CHANNELS_24] = "FFFFFFFFFFFFFFFFFFFFFFFFFFFF";
+ static UINT8 ScanControlTable5Def[2 * A_5G_BAND_NUM_CHANNELS] = "FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000000000000000000000000000000000000000000000000000000000000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000000000FF000000FF000000FF000000FF00000000000000000000000000000000000000";
+ UINT8 reportSeverityTableDefaults[WLAN_MAX_SEVERITIES] = "00000000000";
UINT8 reportModuleTableDefaults[WLAN_MAX_LOG_MODULES];
UINT16 reportSeverityTableLen;
UINT16 reportModuleTableLen;
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 669e9cc..9770803 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
@@ -1814,10 +1814,12 @@ int omap1610_drv_create(void)
#define TROUT_IRQ MSM_GPIO_TO_INT(29)
+#ifdef SDIO_INTERRUPT_HANDLING_ON
static void tiwlan_sdio_irq(struct sdio_func *func)
{
printk("%s:\n", __FUNCTION__);
}
+#endif
static const struct sdio_device_id tiwlan_sdio_ids[] = {
{ SDIO_DEVICE_CLASS(SDIO_CLASS_WLAN) },
@@ -1865,11 +1867,11 @@ static int tiwlan_sdio_probe(struct sdio_func *func, const struct sdio_device_id
rc = tiwlan_sdio_init(func);
if (rc)
goto err2;
-
+#ifdef SDIO_INTERRUPT_HANDLING_ON
rc = sdio_claim_irq(func, tiwlan_sdio_irq);
if (rc)
goto err1;
-
+#endif
SDIO_SetFunc( func );
rc = tiwlan_create_drv(0, 0, 0, 0, 0, TROUT_IRQ, NULL, NULL);
@@ -1877,8 +1879,10 @@ static int tiwlan_sdio_probe(struct sdio_func *func, const struct sdio_device_id
printk(KERN_INFO "TIWLAN: Driver initialized (rc %d)\n", rc);
complete(&sdio_wait);
return rc;
+#ifdef SDIO_INTERRUPT_HANDLING_ON
err1:
sdio_disable_func(func);
+#endif
err2:
sdio_release_host(func);
complete(&sdio_wait);
@@ -1889,7 +1893,9 @@ err2:
static void tiwlan_sdio_remove(struct sdio_func *func)
{
printk(KERN_DEBUG "TIWLAN: Releasing SDIO resources\n");
+#ifdef SDIO_INTERRUPT_HANDLING_ON
sdio_release_irq(func);
+#endif
sdio_disable_func(func);
sdio_release_host(func);
printk(KERN_DEBUG "TIWLAN: SDIO resources released\n");
diff --git a/sta_dk_4_0_4_32/wpa_supplicant_lib/driver_ti.c b/sta_dk_4_0_4_32/wpa_supplicant_lib/driver_ti.c
index f5c1aa9..9639859 100644
--- a/sta_dk_4_0_4_32/wpa_supplicant_lib/driver_ti.c
+++ b/sta_dk_4_0_4_32/wpa_supplicant_lib/driver_ti.c
@@ -1677,6 +1677,8 @@ int wpa_driver_tista_driver_cmd( void *priv, char *cmd, char *buf, size_t buf_le
else if( os_strcasecmp(cmd, "rssi") == 0 ) {
#if 1
u8 ssid[MAX_SSID_LEN];
+ struct wpa_scan_result *cur_res;
+ struct wpa_supplicant *wpa_s = (struct wpa_supplicant *)(myDrv->hWpaSupplicant);
int rssi, len;
wpa_printf(MSG_DEBUG,"rssi command");
@@ -1688,9 +1690,12 @@ int wpa_driver_tista_driver_cmd( void *priv, char *cmd, char *buf, size_t buf_le
os_memcpy( (void *)buf, (void *)ssid, len );
ret = len;
ret += snprintf(&buf[ret], buf_len-len, " rssi %d\n", rssi);
- if (ret < (int)buf_len) {
+ if( !wpa_s )
return( ret );
- }
+ cur_res = scan_get_by_bssid( myDrv, wpa_s->bssid );
+ if( cur_res )
+ cur_res->level = rssi;
+ return( ret );
}
}
#else
diff --git a/wilink_6_1/external_drivers/zoom2/Linux/sdio/Makefile b/wilink_6_1/external_drivers/zoom2/Linux/sdio/Makefile
deleted file mode 100644
index 9524131..0000000
--- a/wilink_6_1/external_drivers/zoom2/Linux/sdio/Makefile
+++ /dev/null
@@ -1,59 +0,0 @@
-
-DK_ROOT = ../../../..
-PLATRFORM_SRC=$(DK_ROOT)/platforms/hw/host_platform_zoom2/linux
-WLAN_INCS := \
- $(DK_ROOT)/Txn \
- $(DK_ROOT)/external_drivers/zoom2/Linux/sdio \
- $(DK_ROOT)/platforms/hw/host_platform_zoom2/linux
-
-EXTRA_CFLAGS += $(addprefix -I, $(WLAN_INCS)) -DTI_SDIO_STANDALONE
-
-SDIO_IN_BAND ?= n
-TRACE ?= n
-STRIP = n
-
-ifeq ($(SDIO_IN_BAND),y)
-EXTRA_CFLAGS += -DSDIO_IN_BAND_INTERRUPT
-endif
-
-ifeq ($(KERNEL_DEBUGGER),y)
- EXTRA_CFLAGS += -g -O2
-endif
-ifeq ($(DEBUG),y)
- EXTRA_CFLAGS += -DSDIO_DEBUG -O2
-else
- EXTRA_CFLAGS += -O2
- STRIP = y
-endif
-
-ifneq ($(KERNELRELEASE),)
-
-obj-m := sdio.o
-ifeq ($(TEST),y)
-obj-m += testsdio.o
-endif
-
-sdio-objs := SdioDrv.o
-ifeq ($(TEST),y)
-testsdio-objs += testdrv.o $(PLATRFORM_SRC)/SdioAdapter.o
-endif
-else
-
-PWD := $(shell pwd)
-all:
- pwd
- @echo EXTRA_CFLAGS = $(EXTRA_CFLAGS)
- $(MAKE) CROSS_COMPILE=$(CROSS_COMPILE) ARCH=$(ARCH) -C $(KERNEL_DIR) M=$(PWD) modules
-ifeq ($(STRIP),y)
- @echo $(CROSS_COMPILE)strip -g sdio.ko
- $(CROSS_COMPILE)strip -g sdio.ko
-ifeq ($(TEST),y)
- $(CROSS_COMPILE)strip -g testsdio.ko
-endif
-endif
-endif
-
-clean:
- rm -f *.o *~ *.~* core .depend dep $(PLATRFORM_SRC)/SdioAdapter.o
- rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
-
diff --git a/wilink_6_1/external_drivers/zoom2/Linux/sdio/SdioDrv.c b/wilink_6_1/external_drivers/zoom2/Linux/sdio/SdioDrv.c
deleted file mode 100644
index 353caa1..0000000
--- a/wilink_6_1/external_drivers/zoom2/Linux/sdio/SdioDrv.c
+++ /dev/null
@@ -1,1257 +0,0 @@
-/*
- * SdioDrv.c
- *
- * Copyright (C) 2009 Texas Instruments, Inc. - http://www.ti.com/
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation version 2.
- *
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- * kind, whether express or implied; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/delay.h>
-#include <linux/interrupt.h>
-#include <linux/slab.h>
-#include <mach/io.h>
-#include <linux/types.h>
-#include <linux/dma-mapping.h>
-#include <mach/hardware.h>
-#include <linux/platform_device.h>
-#include <mach/hardware.h>
-#include <linux/i2c/twl4030.h>
-#include <mach/board.h>
-#include <linux/errno.h>
-#include <linux/clk.h>
-#include <mach/clock.h>
-#include <mach/dma.h>
-#include <mach/io.h>
-#include <mach/resource.h>
-typedef void* TI_HANDLE;
-#include "host_platform.h"
-#include "SdioDrvDbg.h"
-#include "SdioDrv.h"
-
-#define TIWLAN_MMC_CONTROLLER 3
-#define TIWLAN_MMC_CONTROLLER_BASE_ADDR OMAP_HSMMC3_BASE
-#define TIWLAN_MMC_CONTROLLER_BASE_SIZE 512
-#define TIWLAN_MMC_MAX_DMA 8192
-
-#define OMAP_MMC_MASTER_CLOCK 96000000
-/*
- * HSMMC Host Controller Registers
- */
-#define OMAP_HSMMC_SYSCONFIG 0x0010
-#define OMAP_HSMMC_SYSSTATUS 0x0014
-#define OMAP_HSMMC_CSRE 0x0024
-#define OMAP_HSMMC_SYSTEST 0x0028
-#define OMAP_HSMMC_CON 0x002C
-#define OMAP_HSMMC_BLK 0x0104
-#define OMAP_HSMMC_ARG 0x0108
-#define OMAP_HSMMC_CMD 0x010C
-#define OMAP_HSMMC_RSP10 0x0110
-#define OMAP_HSMMC_RSP32 0x0114
-#define OMAP_HSMMC_RSP54 0x0118
-#define OMAP_HSMMC_RSP76 0x011C
-#define OMAP_HSMMC_DATA 0x0120
-#define OMAP_HSMMC_PSTATE 0x0124
-#define OMAP_HSMMC_HCTL 0x0128
-#define OMAP_HSMMC_SYSCTL 0x012C
-#define OMAP_HSMMC_STAT 0x0130
-#define OMAP_HSMMC_IE 0x0134
-#define OMAP_HSMMC_ISE 0x0138
-#define OMAP_HSMMC_AC12 0x013C
-#define OMAP_HSMMC_CAPA 0x0140
-#define OMAP_HSMMC_CUR_CAPA 0x0148
-#define OMAP_HSMMC_REV 0x01FC
-
-#define VS18 (1 << 26)
-#define VS30 (1 << 25)
-#define SRA (1 << 24)
-#define SDVS18 (0x5 << 9)
-#define SDVS30 (0x6 << 9)
-#define SDVSCLR 0xFFFFF1FF
-#define SDVSDET 0x00000400
-#define SIDLE_MODE (0x2 << 3)
-#define AUTOIDLE 0x1
-#define SDBP (1 << 8)
-#define DTO 0xE
-#define ICE 0x1
-#define ICS 0x2
-#define CEN (1 << 2)
-#define CLKD_MASK 0x0000FFC0
-#define IE_EN_MASK 0x317F0137
-#define INIT_STREAM (1 << 1)
-#define DP_SELECT (1 << 21)
-#define DDIR (1 << 4)
-#define DMA_EN 0x1
-#define MSBS (1 << 5)
-#define BCE (1 << 1)
-#define ONE_BIT (~(0x2))
-#define EIGHT_BIT (~(0x20))
-#define CC 0x1
-#define TC 0x02
-#define OD 0x1
-#define BRW 0x400
-#define BRR 0x800
-#define BRE (1 << 11)
-#define BWE (1 << 10)
-#define SBGR (1 << 16)
-#define CT (1 << 17)
-#define SDIO_READ (1 << 31)
-#define SDIO_BLKMODE (1 << 27)
-#define OMAP_HSMMC_ERR (1 << 15) /* Any error */
-#define OMAP_HSMMC_CMD_TIMEOUT (1 << 16) /* Com mand response time-out */
-#define OMAP_HSMMC_DATA_TIMEOUT (1 << 20) /* Data response time-out */
-#define OMAP_HSMMC_CMD_CRC (1 << 17) /* Command CRC error */
-#define OMAP_HSMMC_DATA_CRC (1 << 21) /* Date CRC error */
-#define OMAP_HSMMC_CARD_ERR (1 << 28) /* Card ERR */
-#define OMAP_HSMMC_STAT_CLEAR 0xFFFFFFFF
-#define INIT_STREAM_CMD 0x00000000
-#define INT_CLEAR 0x00000000
-#define BLK_CLEAR 0x00000000
-
-/* SCM CONTROL_DEVCONF1 MMC1 overwrite but */
-
-#define MMC1_ACTIVE_OVERWRITE (1 << 31)
-
-#define sdio_blkmode_regaddr 0x2000
-#define sdio_blkmode_mask 0xFF00
-
-#define IO_RW_DIRECT_MASK 0xF000FF00
-#define IO_RW_DIRECT_ARG_MASK 0x80001A00
-
-#define RMASK (MMC_RSP_MASK | MMC_RSP_CRC)
-#define MMC_TIMEOUT_MS 100 /*on the new 2430 it was 20, i changed back to 100*//* obc */
-#define MMCA_VSN_4 4
-
-#define VMMC1_DEV_GRP 0x27
-#define P1_DEV_GRP 0x20
-#define VMMC1_DEDICATED 0x2A
-#define VSEL_3V 0x02
-#define VSEL_18V 0x00
-#define PBIAS_3V 0x03
-#define PBIAS_18V 0x02
-#define PBIAS_LITE 0x04A0
-#define PBIAS_CLR 0x00
-
-#define OMAP_MMC_REGS_BASE IO_ADDRESS(TIWLAN_MMC_CONTROLLER_BASE_ADDR)
-
-#define INT_MMC3_IRQ 94
-#define OMAP_MMC_IRQ INT_MMC3_IRQ
-/*
- * MMC Host controller read/write API's.
- */
-#define OMAP_HSMMC_READ_OFFSET(offset) (__raw_readl((OMAP_MMC_REGS_BASE) + (offset)))
-#define OMAP_HSMMC_READ(reg) (__raw_readl((OMAP_MMC_REGS_BASE) + OMAP_HSMMC_##reg))
-#define OMAP_HSMMC_WRITE(reg, val) (__raw_writel((val), (OMAP_MMC_REGS_BASE) + OMAP_HSMMC_##reg))
-
-#define OMAP_HSMMC_SEND_COMMAND(cmd, arg) do \
-{ \
- OMAP_HSMMC_WRITE(ARG, arg); \
- OMAP_HSMMC_WRITE(CMD, cmd); \
-} while (0)
-
-#define OMAP_HSMMC_CMD52_WRITE ((SD_IO_RW_DIRECT << 24) | (OMAP_HSMMC_CMD_SHORT_RESPONSE << 16))
-#define OMAP_HSMMC_CMD52_READ (((SD_IO_RW_DIRECT << 24) | (OMAP_HSMMC_CMD_SHORT_RESPONSE << 16)) | DDIR)
-#define OMAP_HSMMC_CMD53_WRITE (((SD_IO_RW_EXTENDED << 24) | (OMAP_HSMMC_CMD_SHORT_RESPONSE << 16)) | DP_SELECT)
-#define OMAP_HSMMC_CMD53_READ (((SD_IO_RW_EXTENDED << 24) | (OMAP_HSMMC_CMD_SHORT_RESPONSE << 16)) | DP_SELECT | DDIR)
-#define OMAP_HSMMC_CMD53_READ_DMA (OMAP_HSMMC_CMD53_READ | DMA_EN)
-#define OMAP_HSMMC_CMD53_WRITE_DMA (OMAP_HSMMC_CMD53_WRITE | DMA_EN)
-
-/* Macros to build commands 52 and 53 in format according to SDIO spec */
-#define SDIO_CMD52_READ(v1,v2,v3,v4) (SDIO_RWFLAG(v1)|SDIO_FUNCN(v2)|SDIO_RAWFLAG(v3)| SDIO_ADDRREG(v4))
-#define SDIO_CMD52_WRITE(v1,v2,v3,v4,v5) (SDIO_RWFLAG(v1)|SDIO_FUNCN(v2)|SDIO_RAWFLAG(v3)| SDIO_ADDRREG(v4)|(v5))
-#define SDIO_CMD53_READ(v1,v2,v3,v4,v5,v6) (SDIO_RWFLAG(v1)|SDIO_FUNCN(v2)|SDIO_BLKM(v3)| SDIO_OPCODE(v4)|SDIO_ADDRREG(v5)|(v6&0x1ff))
-#define SDIO_CMD53_WRITE(v1,v2,v3,v4,v5,v6) (SDIO_RWFLAG(v1)|SDIO_FUNCN(v2)|SDIO_BLKM(v3)| SDIO_OPCODE(v4)|SDIO_ADDRREG(v5)|(v6&0x1ff))
-
-#define SDIODRV_MAX_LOOPS 50000
-
-#define VMMC2_DEV_GRP 0x2B
-#define VMMC2_DEDICATED 0x2E
-#define VSEL_S2_18V 0x05
-#define LDO_CLR 0x00
-#define VSEL_S2_CLR 0x40
-#define GPIO_0_BIT_POS 1 << 0
-#define GPIO_1_BIT_POS 1 << 1
-#define VSIM_DEV_GRP 0x37
-#define VSIM_DEDICATED 0x3A
-#define TWL4030_MODULE_PM_RECIEVER 0x13
-
-typedef struct OMAP3430_sdiodrv
-{
- struct clk *fclk, *iclk, *dbclk;
- int ifclks_enabled;
- spinlock_t clk_lock;
- int dma_tx_channel;
- int dma_rx_channel;
- int irq;
- void (*BusTxnCB)(void* BusTxnHandle, int status);
- void* BusTxnHandle;
- unsigned int uBlkSize;
- unsigned int uBlkSizeShift;
- char *dma_buffer;
- void *async_buffer;
- unsigned int async_length;
- int async_status;
- int (*wlanDrvIf_pm_resume)(void);
- int (*wlanDrvIf_pm_suspend)(void);
- struct device *dev;
- dma_addr_t dma_read_addr;
- size_t dma_read_size;
- dma_addr_t dma_write_addr;
- size_t dma_write_size;
-} OMAP3430_sdiodrv_t;
-
-struct omap_hsmmc_regs {
- u32 hctl;
- u32 capa;
- u32 sysconfig;
- u32 ise;
- u32 ie;
- u32 con;
- u32 sysctl;
-};
-static struct omap_hsmmc_regs hsmmc_ctx;
-
-#define SDIO_DRIVER_NAME "TIWLAN_SDIO"
-
-module_param(g_sdio_debug_level, int, 0644);
-MODULE_PARM_DESC(g_sdio_debug_level, "debug level");
-int g_sdio_debug_level = SDIO_DEBUGLEVEL_ERR;
-EXPORT_SYMBOL( g_sdio_debug_level);
-
-OMAP3430_sdiodrv_t g_drv;
-
-struct work_struct sdiodrv_work;
-
-static int sdiodrv_dma_on = 0;
-static int sdiodrv_irq_requested = 0;
-
-static int sdioDrv_clk_enable(void);
-static void sdioDrv_clk_disable(void);
-
-static int sdiodrv_iclk_got = 0;
-static int sdiodrv_fclk_got = 0;
-
-static void sdioDrv_hsmmc_save_ctx()
-{
- /* MMC : context save */
- hsmmc_ctx.hctl = OMAP_HSMMC_READ(HCTL);
- hsmmc_ctx.capa = OMAP_HSMMC_READ(CAPA);
- hsmmc_ctx.sysconfig = OMAP_HSMMC_READ(SYSCONFIG);
- hsmmc_ctx.ise = OMAP_HSMMC_READ(ISE);
- hsmmc_ctx.ie = OMAP_HSMMC_READ(IE);
- hsmmc_ctx.con = OMAP_HSMMC_READ(CON);
- hsmmc_ctx.sysctl = OMAP_HSMMC_READ(SYSCTL);
-}
-
-static void sdioDrv_hsmmc_restore_ctx()
-{
- /* MMC : context restore */
- OMAP_HSMMC_WRITE(HCTL, hsmmc_ctx.hctl);
- OMAP_HSMMC_WRITE(CAPA, hsmmc_ctx.capa);
- OMAP_HSMMC_WRITE(SYSCONFIG, hsmmc_ctx.sysconfig);
- OMAP_HSMMC_WRITE(CON, hsmmc_ctx.con);
- OMAP_HSMMC_WRITE(ISE, hsmmc_ctx.ise);
- OMAP_HSMMC_WRITE(IE, hsmmc_ctx.ie);
- OMAP_HSMMC_WRITE(SYSCTL, hsmmc_ctx.sysctl);
- OMAP_HSMMC_WRITE(HCTL, OMAP_HSMMC_READ(HCTL) | SDBP);
-}
-
-void sdiodrv_task(struct work_struct *unused)
-{
- PDEBUG("sdiodrv_tasklet()\n");
-
- if (g_drv.dma_read_addr != 0) {
- dma_unmap_single(g_drv.dev, g_drv.dma_read_addr, g_drv.dma_read_size, DMA_FROM_DEVICE);
- g_drv.dma_read_addr = 0;
- g_drv.dma_read_size = 0;
- }
-
- if (g_drv.dma_write_addr != 0) {
- dma_unmap_single(g_drv.dev, g_drv.dma_write_addr, g_drv.dma_write_size, DMA_TO_DEVICE);
- g_drv.dma_write_addr = 0;
- g_drv.dma_write_size = 0;
- }
-
- if (g_drv.async_buffer) {
- memcpy(g_drv.async_buffer, g_drv.dma_buffer, g_drv.async_length);
- g_drv.async_buffer = NULL;
- }
-
- if (g_drv.BusTxnCB != NULL) {
- g_drv.BusTxnCB(g_drv.BusTxnHandle, g_drv.async_status);
- }
-}
-
-irqreturn_t sdiodrv_irq(int irq, void *drv)
-{
- int status;
-
- PDEBUG("sdiodrv_irq()\n");
-
- status = OMAP_HSMMC_READ(STAT);
- OMAP_HSMMC_WRITE(ISE, 0);
- g_drv.async_status = status & (OMAP_HSMMC_ERR);
- if (g_drv.async_status) {
- PERR("sdiodrv_irq: ERROR in STAT = 0x%x\n", status);
- }
- schedule_work(&sdiodrv_work);
-
- return IRQ_HANDLED;
-}
-
-void sdiodrv_dma_read_cb(int lch, u16 ch_status, void *data)
-{
- PDEBUG("sdiodrv_dma_read_cb() channel=%d status=0x%x\n", lch, (int)ch_status);
-
- g_drv.async_status = ch_status & (1 << 7);
-
- schedule_work(&sdiodrv_work);
-}
-
-void sdiodrv_dma_write_cb(int lch, u16 ch_status, void *data)
-{
-}
-
-int sdiodrv_dma_init(void)
-{
- int rc;
-
- rc = omap_request_dma(OMAP34XX_DMA_MMC3_TX, "SDIO WRITE", sdiodrv_dma_write_cb, &g_drv, &g_drv.dma_tx_channel);
- if (rc != 0) {
- PERR("sdiodrv_dma_init() omap_request_dma(OMAP34XX_DMA_MMC2_TX) FAILED\n");
- goto out;
- }
-
- rc = omap_request_dma(OMAP34XX_DMA_MMC3_RX, "SDIO READ", sdiodrv_dma_read_cb, &g_drv, &g_drv.dma_rx_channel);
- if (rc != 0) {
- PERR("sdiodrv_dma_init() omap_request_dma(OMAP24XX_DMA_MMC2_RX) FAILED\n");
- goto freetx;
- }
-
- omap_set_dma_src_params(g_drv.dma_rx_channel,
- 0, // src_port is only for OMAP1
- OMAP_DMA_AMODE_CONSTANT,
- (OMAP_HSMMC3_BASE) + OMAP_HSMMC_DATA, 0, 0);
-
- omap_set_dma_dest_params(g_drv.dma_tx_channel,
- 0, // dest_port is only for OMAP1
- OMAP_DMA_AMODE_CONSTANT,
- (OMAP_HSMMC3_BASE) + OMAP_HSMMC_DATA, 0, 0);
-
- if ((g_drv.dma_buffer = kmalloc(TIWLAN_MMC_MAX_DMA, GFP_ATOMIC|GFP_DMA)) == NULL) {
- rc = -ENOMEM;
- goto freerx;
- }
-
- return 0;
-
-freerx:
- omap_free_dma(g_drv.dma_rx_channel);
-freetx:
- omap_free_dma(g_drv.dma_tx_channel);
-out:
- return rc;
-}
-
-void sdiodrv_dma_shutdown(void)
-{
- omap_free_dma(g_drv.dma_tx_channel);
- omap_free_dma(g_drv.dma_rx_channel);
- if (g_drv.dma_buffer) {
- kfree(g_drv.dma_buffer);
- g_drv.dma_buffer = NULL;
- }
-} /* sdiodrv_dma_shutdown() */
-
-static u32 sdiodrv_poll_status(u32 reg_offset, u32 stat, unsigned int msecs)
-{
- u32 status=0, loops=0;
-
- do
- {
- status=OMAP_HSMMC_READ_OFFSET(reg_offset);
- if(( status & stat))
- {
- break;
- }
- } while (loops++ < SDIODRV_MAX_LOOPS);
-
- return status;
-} /* sdiodrv_poll_status */
-
-void dumpreg(void)
-{
- printk(KERN_ERR "\n MMCHS_SYSCONFIG for mmc3 = %x ", omap_readl( 0x480AD010 ));
- printk(KERN_ERR "\n MMCHS_SYSSTATUS for mmc3 = %x ", omap_readl( 0x480AD014 ));
- printk(KERN_ERR "\n MMCHS_CSRE for mmc3 = %x ", omap_readl( 0x480AD024 ));
- printk(KERN_ERR "\n MMCHS_SYSTEST for mmc3 = %x ", omap_readl( 0x480AD028 ));
- printk(KERN_ERR "\n MMCHS_CON for mmc3 = %x ", omap_readl( 0x480AD02C ));
- printk(KERN_ERR "\n MMCHS_PWCNT for mmc3 = %x ", omap_readl( 0x480AD030 ));
- printk(KERN_ERR "\n MMCHS_BLK for mmc3 = %x ", omap_readl( 0x480AD104 ));
- printk(KERN_ERR "\n MMCHS_ARG for mmc3 = %x ", omap_readl( 0x480AD108 ));
- printk(KERN_ERR "\n MMCHS_CMD for mmc3 = %x ", omap_readl( 0x480AD10C ));
- printk(KERN_ERR "\n MMCHS_RSP10 for mmc3 = %x ", omap_readl( 0x480AD110 ));
- printk(KERN_ERR "\n MMCHS_RSP32 for mmc3 = %x ", omap_readl( 0x480AD114 ));
- printk(KERN_ERR "\n MMCHS_RSP54 for mmc3 = %x ", omap_readl( 0x480AD118 ));
- printk(KERN_ERR "\n MMCHS_RSP76 for mmc3 = %x ", omap_readl( 0x480AD11C ));
- printk(KERN_ERR "\n MMCHS_DATA for mmc3 = %x ", omap_readl( 0x480AD120 ));
- printk(KERN_ERR "\n MMCHS_PSTATE for mmc3 = %x ", omap_readl( 0x480AD124 ));
- printk(KERN_ERR "\n MMCHS_HCTL for mmc3 = %x ", omap_readl( 0x480AD128 ));
- printk(KERN_ERR "\n MMCHS_SYSCTL for mmc3 = %x ", omap_readl( 0x480AD12C ));
- printk(KERN_ERR "\n MMCHS_STAT for mmc3 = %x ", omap_readl( 0x480AD130 ));
- printk(KERN_ERR "\n MMCHS_IE for mmc3 = %x ", omap_readl( 0x480AD134 ));
- printk(KERN_ERR "\n MMCHS_ISE for mmc3 = %x ", omap_readl( 0x480AD138 ));
- printk(KERN_ERR "\n MMCHS_AC12 for mmc3 = %x ", omap_readl( 0x480AD13C ));
- printk(KERN_ERR "\n MMCHS_CAPA for mmc3 = %x ", omap_readl( 0x480AD140 ));
- printk(KERN_ERR "\n MMCHS_CUR_CAPA for mmc3 = %x ", omap_readl( 0x480AD148 ));
-}
-
-//cmd flow p. 3609 obc
-static int sdiodrv_send_command(u32 cmdreg, u32 cmdarg)
-{
- OMAP_HSMMC_WRITE(STAT, OMAP_HSMMC_STAT_CLEAR);
- OMAP_HSMMC_SEND_COMMAND(cmdreg, cmdarg);
-
- return sdiodrv_poll_status(OMAP_HSMMC_STAT, CC, MMC_TIMEOUT_MS);
-
-} /* sdiodrv_send_command() */
-
-/*
- * Disable clock to the card
- */
-static void OMAP3430_mmc_stop_clock(void)
-{
- OMAP_HSMMC_WRITE(SYSCTL, OMAP_HSMMC_READ(SYSCTL) & ~CEN);
- if ((OMAP_HSMMC_READ(SYSCTL) & CEN) != 0x0)
- {
- PERR("MMC clock not stoped, clock freq can not be altered\n");
- }
-} /* OMAP3430_mmc_stop_clock */
-
-/*
- * Reset the SD system
- */
-int OMAP3430_mmc_reset(void)
-{
- int status, loops=0;
- //p. 3598 - need to set SOFTRESET to 0x1 0bc
- OMAP_HSMMC_WRITE(SYSCTL, OMAP_HSMMC_READ(SYSCTL) | SRA);
- while ((status = OMAP_HSMMC_READ(SYSCTL) & SRA) && loops++ < SDIODRV_MAX_LOOPS);
- if (status & SRA)
- {
- PERR("OMAP3430_mmc_reset() MMC reset FAILED!! status=0x%x\n",status);
- }
-
- return status;
-
-} /* OMAP3430_mmc_reset */
-
-//p. 3611
-static void OMAP3430_mmc_set_clock(unsigned int clock, OMAP3430_sdiodrv_t *host)
-{
- u16 dsor = 0;
- unsigned long regVal;
- int status;
-
- PDEBUG("OMAP3430_mmc_set_clock(%d)\n",clock);
- if (clock) {
- /* Enable MMC_SD_CLK */
- dsor = OMAP_MMC_MASTER_CLOCK / clock;
- if (dsor < 1) {
- dsor = 1;
- }
- if (OMAP_MMC_MASTER_CLOCK / dsor > clock) {
- dsor++;
- }
- if (dsor > 250) {
- dsor = 250;
- }
- }
- OMAP3430_mmc_stop_clock();
- regVal = OMAP_HSMMC_READ(SYSCTL);
- regVal = regVal & ~(CLKD_MASK);//p. 3652
- regVal = regVal | (dsor << 6);
- regVal = regVal | (DTO << 16);//data timeout
- OMAP_HSMMC_WRITE(SYSCTL, regVal);
- OMAP_HSMMC_WRITE(SYSCTL, OMAP_HSMMC_READ(SYSCTL) | ICE);//internal clock enable. obc not mentioned in the spec
- /*
- * wait till the the clock is stable (ICS) bit is set
- */
- status = sdiodrv_poll_status(OMAP_HSMMC_SYSCTL, ICS, MMC_TIMEOUT_MS);
- if(!(status & ICS)) {
- PERR("OMAP3430_mmc_set_clock() clock not stable!! status=0x%x\n",status);
- }
- /*
- * Enable clock to the card
- */
- OMAP_HSMMC_WRITE(SYSCTL, OMAP_HSMMC_READ(SYSCTL) | CEN);
-
-} /* OMAP3430_mmc_set_clock() */
-
-static void sdiodrv_free_resources(void)
-{
- if(g_drv.ifclks_enabled) {
- sdioDrv_clk_disable();
- }
-
- if (sdiodrv_fclk_got) {
- clk_put(g_drv.fclk);
- sdiodrv_fclk_got = 0;
- }
-
- if (sdiodrv_iclk_got) {
- clk_put(g_drv.iclk);
- sdiodrv_iclk_got = 0;
- }
-
- if (sdiodrv_irq_requested) {
- free_irq(OMAP_MMC_IRQ, &g_drv);
- sdiodrv_irq_requested = 0;
- }
-
- if (sdiodrv_dma_on) {
- sdiodrv_dma_shutdown();
- sdiodrv_dma_on = 0;
- }
-}
-
-int sdioDrv_InitHw(void)
-{
- return 0;
-} /* sdiodrv_init */
-
-void sdiodrv_shutdown(void)
-{
- PDEBUG("entering %s()\n" , __FUNCTION__ );
-
- sdiodrv_free_resources();
-
- PDEBUG("exiting %s\n", __FUNCTION__);
-} /* sdiodrv_shutdown() */
-
-static int sdiodrv_send_data_xfer_commad(u32 cmd, u32 cmdarg, int length, u32 buffer_enable_status, unsigned int bBlkMode)
-{
- int status;
-
- PDEBUG("%s() writing CMD 0x%x ARG 0x%x\n",__FUNCTION__, cmd, cmdarg);
-
- /* block mode */
- if(bBlkMode) {
- /*
- * Bits 31:16 of BLK reg: NBLK Blocks count for current transfer.
- * in case of Block MOde the lenght is treated here as number of blocks
- * (and not as a length).
- * Bits 11:0 of BLK reg: BLEN Transfer Block Size. in case of block mode set that field to block size.
- */
- OMAP_HSMMC_WRITE(BLK, (length << 16) | (g_drv.uBlkSize << 0));
-
- /*
- * In CMD reg:
- * BCE: Block Count Enable
- * MSBS: Multi/Single block select
- */
- cmd |= MSBS | BCE ;
- } else {
- OMAP_HSMMC_WRITE(BLK, length);
- }
-
- status = sdiodrv_send_command(cmd, cmdarg);
- if(!(status & CC)) {
- PERR("sdiodrv_send_data_xfer_commad() SDIO Command error! STAT = 0x%x\n", status);
- return 0;
- }
- PDEBUG("%s() length = %d(%dw) BLK = 0x%x\n",
- __FUNCTION__, length,((length + 3) >> 2), OMAP_HSMMC_READ(BLK));
-
- return sdiodrv_poll_status(OMAP_HSMMC_PSTATE, buffer_enable_status, MMC_TIMEOUT_MS);
-
-} /* sdiodrv_send_data_xfer_commad() */
-
-int sdiodrv_data_xfer_sync(u32 cmd, u32 cmdarg, void *data, int length, u32 buffer_enable_status)
-{
- u32 buf_start, buf_end, data32;
- int status;
-
- status = sdiodrv_send_data_xfer_commad(cmd, cmdarg, length, buffer_enable_status, 0);
- if(!(status & buffer_enable_status))
- {
- PERR("sdiodrv_data_xfer_sync() buffer disabled! length = %d BLK = 0x%x PSTATE = 0x%x\n",
- length, OMAP_HSMMC_READ(BLK), status);
- return -1;
- }
- buf_end = (u32)data+(u32)length;
-
- //obc need to check BRE/BWE every time, see p. 3605
- /*
- * Read loop
- */
- if (buffer_enable_status == BRE)
- {
- if (((u32)data & 3) == 0) /* 4 bytes aligned */
- {
- for (buf_start = (u32)data; (u32)data < buf_end; data += sizeof(unsigned long))
- {
- *((unsigned long*)(data)) = OMAP_HSMMC_READ(DATA);
- }
- }
- else /* 2 bytes aligned */
- {
- for (buf_start = (u32)data; (u32)data < buf_end; data += sizeof(unsigned long))
- {
- data32 = OMAP_HSMMC_READ(DATA);
- *((unsigned short *)data) = (unsigned short)data32;
- *((unsigned short *)data + 1) = (unsigned short)(data32 >> 16);
- }
- }
- }
- /*
- * Write loop
- */
- else
- {
- if (((u32)data & 3) == 0) /* 4 bytes aligned */
- {
- for (buf_start = (u32)data; (u32)data < buf_end; data += sizeof(unsigned long))
- {
- OMAP_HSMMC_WRITE(DATA,*((unsigned long*)(data)));
- }
- }
- else /* 2 bytes aligned */
- {
- for (buf_start = (u32)data; (u32)data < buf_end; data += sizeof(unsigned long))
- {
- OMAP_HSMMC_WRITE(DATA,*((unsigned short*)data) | *((unsigned short*)data+1) << 16 );
- }
-
- }
- }
- status = sdiodrv_poll_status(OMAP_HSMMC_STAT, TC, MMC_TIMEOUT_MS);
- if(!(status & TC))
- {
- PERR("sdiodrv_data_xfer_sync() transfer error! STAT = 0x%x\n", status);
- return -1;
- }
-
- return 0;
-
-} /* sdiodrv_data_xfer_sync() */
-
-int sdioDrv_ConnectBus (void * fCbFunc,
- void * hCbArg,
- unsigned int uBlkSizeShift,
- unsigned int uSdioThreadPriority,
- unsigned char **pTxDmaSrcAddr)
-{
- g_drv.BusTxnCB = fCbFunc;
- g_drv.BusTxnHandle = hCbArg;
- g_drv.uBlkSizeShift = uBlkSizeShift;
- g_drv.uBlkSize = 1 << uBlkSizeShift;
-
- INIT_WORK(&sdiodrv_work, sdiodrv_task);
-
- /* Provide the DMA buffer address to the upper layer so it will use it as the transactions host buffer. */
- if (pTxDmaSrcAddr)
- {
- *pTxDmaSrcAddr = g_drv.dma_buffer;
- }
-
- return sdioDrv_InitHw ();
-}
-
-int sdioDrv_DisconnectBus (void)
-{
- return 0;
-}
-
-//p.3609 cmd flow
-int sdioDrv_ExecuteCmd (unsigned int uCmd,
- unsigned int uArg,
- unsigned int uRespType,
- void * pResponse,
- unsigned int uLen)
-{
- unsigned int uCmdReg = 0;
- unsigned int uStatus = 0;
- unsigned int uResponse = 0;
-
- PDEBUG("sdioDrv_ExecuteCmd() starting cmd %02x arg %08x\n", (int)uCmd, (int)uArg);
-
- uCmdReg = (uCmd << 24) | (uRespType << 16) ;
-
- uStatus = sdiodrv_send_command(uCmdReg, uArg);
-
- if (!(uStatus & CC))
- {
- PERR("sdioDrv_ExecuteCmd() SDIO Command error status = 0x%x\n", uStatus);
- return -1;
- }
- if ((uLen > 0) && (uLen <= 4))/*obc - Len > 4 ? shouldn't read anything ? */
- {
- uResponse = OMAP_HSMMC_READ(RSP10);
- memcpy (pResponse, (char *)&uResponse, uLen);
- PDEBUG("sdioDrv_ExecuteCmd() response = 0x%x\n", uResponse);
- }
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------------------*/
-
-int sdioDrv_ReadSync (unsigned int uFunc,
- unsigned int uHwAddr,
- void * pData,
- unsigned int uLen,
- unsigned int bIncAddr,
- unsigned int bMore)
-{
- unsigned int uCmdArg;
- int iStatus;
-
-// printk(KERN_INFO "in sdioDrv_ReadSync\n");
-
- uCmdArg = SDIO_CMD53_READ(0, uFunc, 0, bIncAddr, uHwAddr, uLen);
-
- iStatus = sdiodrv_data_xfer_sync(OMAP_HSMMC_CMD53_READ, uCmdArg, pData, uLen, BRE);
- if (iStatus != 0)
- {
- PERR("sdioDrv_ReadSync() FAILED!!\n");
- }
-
- return iStatus;
-}
-
-/*--------------------------------------------------------------------------------------*/
-int sdioDrv_ReadAsync (unsigned int uFunc,
- unsigned int uHwAddr,
- void * pData,
- unsigned int uLen,
- unsigned int bBlkMode,
- unsigned int bIncAddr,
- unsigned int bMore)
-{
- int iStatus;
- unsigned int uCmdArg;
- unsigned int uNumBlks;
- unsigned int uDmaBlockCount;
- unsigned int uNumOfElem;
- void *dma_buffer;
- dma_addr_t dma_bus_address;
-
- //printk(KERN_INFO "in sdioDrv_ReadAsync\n");
-
- if (bBlkMode)
- {
- /* For block mode use number of blocks instead of length in bytes */
- uNumBlks = uLen >> g_drv.uBlkSizeShift;
- uDmaBlockCount = uNumBlks;
- /* due to the DMA config to 32Bit per element (OMAP_DMA_DATA_TYPE_S32) the division is by 4 */
- uNumOfElem = g_drv.uBlkSize >> 2;
- }
- else
- {
- uNumBlks = uLen;
- uDmaBlockCount = 1;
- uNumOfElem = (uLen + 3) >> 2;
- }
-
- if (((u32)pData & 3) == 0) /* 4 bytes aligned */
- {
- dma_buffer = pData;
- }
- else /* 2 bytes aligned */
- {
- dma_buffer = g_drv.dma_buffer;
- g_drv.async_buffer = pData;
- g_drv.async_length = uLen;
- }
-
- uCmdArg = SDIO_CMD53_READ(0, uFunc, bBlkMode, bIncAddr, uHwAddr, uNumBlks);
-
- iStatus = sdiodrv_send_data_xfer_commad(OMAP_HSMMC_CMD53_READ_DMA, uCmdArg, uNumBlks, BRE, bBlkMode);
-
- if (!(iStatus & BRE))
- {
- PERR("sdioDrv_ReadAsync() buffer disabled! length = %d BLK = 0x%x PSTATE = 0x%x, BlkMode = %d\n",
- uLen, OMAP_HSMMC_READ(BLK), iStatus, bBlkMode);
- goto err;
- }
-
- PDEBUG("sdiodrv_read_async() dma_ch=%d \n",g_drv.dma_rx_channel);
-
- dma_bus_address = dma_map_single(g_drv.dev, dma_buffer, uLen, DMA_FROM_DEVICE);
- if (!dma_bus_address) {
- PERR("sdioDrv_ReadAsync: dma_map_single failed\n");
- goto err;
- }
-
- if (g_drv.dma_read_addr != 0) {
- printk(KERN_ERR "sdioDrv_ReadAsync: previous DMA op is not finished!\n");
- BUG();
- }
-
- g_drv.dma_read_addr = dma_bus_address;
- g_drv.dma_read_size = uLen;
-
- omap_set_dma_dest_params (g_drv.dma_rx_channel,
- 0, // dest_port is only for OMAP1
- OMAP_DMA_AMODE_POST_INC,
- dma_bus_address,
- 0, 0);
-
- omap_set_dma_transfer_params(g_drv.dma_rx_channel, OMAP_DMA_DATA_TYPE_S32, uNumOfElem , uDmaBlockCount , OMAP_DMA_SYNC_FRAME, OMAP34XX_DMA_MMC3_RX, OMAP_DMA_SRC_SYNC);
-
- omap_start_dma(g_drv.dma_rx_channel);
-
- /* Continued at sdiodrv_irq() after DMA transfer is finished */
- return 0;
-err:
- return -1;
-
-}
-
-
-/*--------------------------------------------------------------------------------------*/
-
-int sdioDrv_WriteSync (unsigned int uFunc,
- unsigned int uHwAddr,
- void * pData,
- unsigned int uLen,
- unsigned int bIncAddr,
- unsigned int bMore)
-{
- unsigned int uCmdArg;
- int iStatus;
-// printk(KERN_INFO "in sdioDrv_WriteSync\n");
-
- uCmdArg = SDIO_CMD53_WRITE(1, uFunc, 0, bIncAddr, uHwAddr, uLen);
-
- iStatus = sdiodrv_data_xfer_sync(OMAP_HSMMC_CMD53_WRITE, uCmdArg, pData, uLen, BWE);
- if (iStatus != 0)
- {
- PERR("sdioDrv_WriteSync() FAILED!!\n");
- }
-
- return iStatus;
-}
-
-/*--------------------------------------------------------------------------------------*/
-int sdioDrv_WriteAsync (unsigned int uFunc,
- unsigned int uHwAddr,
- void * pData,
- unsigned int uLen,
- unsigned int bBlkMode,
- unsigned int bIncAddr,
- unsigned int bMore)
-{
- int iStatus;
- unsigned int uCmdArg;
- unsigned int uNumBlks;
- unsigned int uDmaBlockCount;
- unsigned int uNumOfElem;
- dma_addr_t dma_bus_address;
-
-// printk(KERN_INFO "in sdioDrv_WriteAsync\n");
-
- if (bBlkMode)
- {
- /* For block mode use number of blocks instead of length in bytes */
- uNumBlks = uLen >> g_drv.uBlkSizeShift;
- uDmaBlockCount = uNumBlks;
- /* due to the DMA config to 32Bit per element (OMAP_DMA_DATA_TYPE_S32) the division is by 4 */
- uNumOfElem = g_drv.uBlkSize >> 2;
- }
- else
- {
- uNumBlks = uLen;
- uDmaBlockCount = 1;
- uNumOfElem = (uLen + 3) >> 2;
- }
-
- uCmdArg = SDIO_CMD53_WRITE(1, uFunc, bBlkMode, bIncAddr, uHwAddr, uNumBlks);
-
- iStatus = sdiodrv_send_data_xfer_commad(OMAP_HSMMC_CMD53_WRITE_DMA, uCmdArg, uNumBlks, BWE, bBlkMode);
- if (!(iStatus & BWE))
- {
- PERR("sdioDrv_WriteAsync() buffer disabled! length = %d, BLK = 0x%x, Status = 0x%x\n",
- uLen, OMAP_HSMMC_READ(BLK), iStatus);
- goto err;
- }
-
- OMAP_HSMMC_WRITE(ISE, TC);
-
- dma_bus_address = dma_map_single(g_drv.dev, pData, uLen, DMA_TO_DEVICE);
- if (!dma_bus_address) {
- PERR("sdioDrv_WriteAsync: dma_map_single failed\n");
- goto err;
- }
-
- if (g_drv.dma_write_addr != 0) {
- PERR("sdioDrv_WriteAsync: previous DMA op is not finished!\n");
- BUG();
- }
-
- g_drv.dma_write_addr = dma_bus_address;
- g_drv.dma_write_size = uLen;
-
- omap_set_dma_src_params (g_drv.dma_tx_channel,
- 0, // src_port is only for OMAP1
- OMAP_DMA_AMODE_POST_INC,
- dma_bus_address,
- 0, 0);
-
- omap_set_dma_transfer_params(g_drv.dma_tx_channel, OMAP_DMA_DATA_TYPE_S32, uNumOfElem, uDmaBlockCount, OMAP_DMA_SYNC_FRAME, OMAP34XX_DMA_MMC3_TX, OMAP_DMA_DST_SYNC);
-
- omap_start_dma(g_drv.dma_tx_channel);
-
- /* Continued at sdiodrv_irq() after DMA transfer is finished */
- return 0;
-err:
- return -1;
-}
-
-/*--------------------------------------------------------------------------------------*/
-
-int sdioDrv_ReadSyncBytes (unsigned int uFunc,
- unsigned int uHwAddr,
- unsigned char *pData,
- unsigned int uLen,
- unsigned int bMore)
-{
- unsigned int uCmdArg;
- unsigned int i;
- int iStatus;
-
- for (i = 0; i < uLen; i++)
- {
- uCmdArg = SDIO_CMD52_READ(0, uFunc, 0, uHwAddr);
-
- iStatus = sdiodrv_send_command(OMAP_HSMMC_CMD52_READ, uCmdArg);
-
- if (!(iStatus & CC))
- {
- PERR("sdioDrv_ReadSyncBytes() SDIO Command error status = 0x%x\n", iStatus);
- return -1;
- }
- else
- {
- *pData = (unsigned char)(OMAP_HSMMC_READ(RSP10));
- }
-
- uHwAddr++;
- pData++;
- }
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------------------*/
-
-int sdioDrv_WriteSyncBytes (unsigned int uFunc,
- unsigned int uHwAddr,
- unsigned char *pData,
- unsigned int uLen,
- unsigned int bMore)
-{
- unsigned int uCmdArg;
- unsigned int i;
- int iStatus;
-
- for (i = 0; i < uLen; i++)
- {
- uCmdArg = SDIO_CMD52_WRITE(1, uFunc, 0, uHwAddr, *pData);
-
- iStatus = sdiodrv_send_command(OMAP_HSMMC_CMD52_WRITE, uCmdArg);
-
- if (!(iStatus & CC))
- {
- PERR("sdioDrv_WriteSyncBytes() SDIO Command error status = 0x%x\n", iStatus);
- return -1;
- }
-
- uHwAddr++;
- pData++;
- }
-
- return 0;
-}
-
-
-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);
-
- /* remember device struct for future DMA operations */
- g_drv.dev = &pdev->dev;
- g_drv.irq = platform_get_irq(pdev, 0);
- if (g_drv.irq < 0)
- return -ENXIO;
-
- rc= request_irq(OMAP_MMC_IRQ, sdiodrv_irq, 0, SDIO_DRIVER_NAME, &g_drv);
- if (rc != 0) {
- PERR("sdioDrv_InitHw() - request_irq FAILED!!\n");
- return rc;
- }
- sdiodrv_irq_requested = 1;
-
- rc = sdiodrv_dma_init();
- if (rc != 0) {
- PERR("sdiodrv_init() - sdiodrv_dma_init FAILED!!\n");
- free_irq(OMAP_MMC_IRQ, &g_drv);
- return rc;
- }
- sdiodrv_dma_on = 1;
-
- spin_lock_init(&g_drv.clk_lock);
-
- g_drv.fclk = clk_get(&pdev->dev, "mmchs_fck");
- if (IS_ERR(g_drv.fclk)) {
- rc = PTR_ERR(g_drv.fclk);
- PERR("clk_get(fclk) FAILED !!!\n");
- goto err;
- }
- sdiodrv_fclk_got = 1;
-
- g_drv.iclk = clk_get(&pdev->dev, "mmchs_ick");
- if (IS_ERR(g_drv.iclk)) {
- rc = PTR_ERR(g_drv.iclk);
- PERR("clk_get(iclk) FAILED !!!\n");
- goto err;
- }
- sdiodrv_iclk_got = 1;
-
- rc = clk_enable(g_drv.iclk);
- if (rc) {
- PERR("clk_enable(iclk) FAILED !!!\n");
- goto err;
- }
-
- rc = clk_enable(g_drv.fclk);
- if (rc) {
- PERR("clk_enable(fclk) FAILED !!!\n");
- goto err;
- }
- g_drv.ifclks_enabled = 1;
-
- 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 = -1;
- goto err;
- }
- OMAP_HSMMC_WRITE(CON, OMAP_HSMMC_READ(CON) & ~INIT_STREAM);
-
- return 0;
-err:
- sdiodrv_free_resources();
- return rc;
-}
-
-static int sdioDrv_remove(struct platform_device *pdev)
-{
- printk(KERN_INFO "sdioDrv_remove: calling sdiodrv_shutdown\n");
-
- sdiodrv_shutdown();
-
- return 0;
-}
-
-#ifdef CONFIG_PM
-static int sdioDrv_suspend(struct platform_device *pdev, pm_message_t state)
-{
- int rc = 0;
-
- /* Tell WLAN driver to suspend, if a suspension function has been registered */
- if (g_drv.wlanDrvIf_pm_suspend) {
- printk(KERN_INFO "TISDIO: Asking TIWLAN to suspend\n");
- rc = g_drv.wlanDrvIf_pm_suspend();
- if (rc != 0)
- return rc;
- }
-
- printk(KERN_INFO "TISDIO: sdioDrv is suspending\n");
-
- sdiodrv_shutdown();
-
- return rc;
-}
-
-/* Routine to resume the MMC device */
-static int sdioDrv_resume(struct platform_device *pdev)
-{
- int rc;
-
- printk(KERN_INFO "TISDIO: sdioDrv is resuming\n");
-
- rc = sdioDrv_probe(pdev);
- if (rc != 0) {
- printk(KERN_ERR "TISDIO: resume error\n");
- return rc;
- }
-
- if (g_drv.wlanDrvIf_pm_resume) {
- printk(KERN_INFO "TISDIO: Asking TIWLAN to resume\n");
- return(g_drv.wlanDrvIf_pm_resume());
- }
- else
- return 0;
-}
-#else
-#define omap_mmc_suspend NULL
-#define omap_mmc_resume NULL
-#endif
-
-static struct platform_driver sdioDrv_struct = {
- .probe = sdioDrv_probe,
- .remove = sdioDrv_remove,
- .suspend = sdioDrv_suspend,
- .resume = sdioDrv_resume,
- .driver = {
- .name = SDIO_DRIVER_NAME,
- },
-};
-
-void sdioDrv_register_pm(int (*wlanDrvIf_Start)(void),
- int (*wlanDrvIf_Stop)(void))
-{
- g_drv.wlanDrvIf_pm_resume = wlanDrvIf_Start;
- g_drv.wlanDrvIf_pm_suspend = wlanDrvIf_Stop;
-}
-
-static int sdioDrv_clk_enable(void)
-{
- unsigned long flags;
- int ret = 0;
-
- spin_lock_irqsave(&g_drv.clk_lock, flags);
- if (g_drv.ifclks_enabled)
- goto done;
- ret = clk_enable(g_drv.iclk);
- if (ret)
- goto clk_en_err1;
- ret = clk_enable(g_drv.fclk);
- if (ret)
- goto clk_en_err2;
- g_drv.ifclks_enabled = 1;
-
- sdioDrv_hsmmc_restore_ctx();
-
-done:
- spin_unlock_irqrestore(&g_drv.clk_lock, flags);
- return ret;
-
-clk_en_err2:
- clk_disable(g_drv.iclk);
-clk_en_err1:
- spin_unlock_irqrestore(&g_drv.clk_lock, flags);
- return ret;
-}
-
-static void sdioDrv_clk_disable(void)
-{
- unsigned long flags;
- spin_lock_irqsave(&g_drv.clk_lock, flags);
- if (!g_drv.ifclks_enabled)
- goto done;
-
- sdioDrv_hsmmc_save_ctx();
-
- clk_disable(g_drv.fclk);
- clk_disable(g_drv.iclk);
- g_drv.ifclks_enabled = 0;
-
-done:
- spin_unlock_irqrestore(&g_drv.clk_lock, flags);
-}
-#ifdef TI_SDIO_STANDALONE
-static
-#endif
-int __init sdioDrv_init(void)
-{
- memset(&g_drv, 0, sizeof(g_drv));
- memset(&hsmmc_ctx, 0, sizeof(hsmmc_ctx));
-
- printk(KERN_INFO "TIWLAN SDIO init\n");
-
- /* Register the sdio driver */
- return platform_driver_register(&sdioDrv_struct);
-}
-
-#ifdef TI_SDIO_STANDALONE
-static
-#endif
-void __exit sdioDrv_exit(void)
-{
- /* Unregister sdio driver */
- platform_driver_unregister(&sdioDrv_struct);
-}
-
-#ifdef TI_SDIO_STANDALONE
-module_init(sdioDrv_init);
-module_exit(sdioDrv_exit);
-#endif
-EXPORT_SYMBOL(sdioDrv_clk_enable);
-EXPORT_SYMBOL(sdioDrv_clk_disable);
-
-EXPORT_SYMBOL(sdioDrv_ConnectBus);
-EXPORT_SYMBOL(sdioDrv_DisconnectBus);
-EXPORT_SYMBOL(sdioDrv_ExecuteCmd);
-EXPORT_SYMBOL(sdioDrv_ReadSync);
-EXPORT_SYMBOL(sdioDrv_WriteSync);
-EXPORT_SYMBOL(sdioDrv_ReadAsync);
-EXPORT_SYMBOL(sdioDrv_WriteAsync);
-EXPORT_SYMBOL(sdioDrv_ReadSyncBytes);
-EXPORT_SYMBOL(sdioDrv_WriteSyncBytes);
-EXPORT_SYMBOL(sdioDrv_register_pm);
-MODULE_DESCRIPTION("TI WLAN SDIO driver");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS(SDIO_DRIVER_NAME);
-MODULE_AUTHOR("Texas Instruments Inc");
diff --git a/wilink_6_1/external_drivers/zoom2/Linux/sdio/SdioDrv.h b/wilink_6_1/external_drivers/zoom2/Linux/sdio/SdioDrv.h
deleted file mode 100644
index 56ab052..0000000
--- a/wilink_6_1/external_drivers/zoom2/Linux/sdio/SdioDrv.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * SdioDrv.h
- *
- * Copyright (C) 2009 Texas Instruments, Inc. - http://www.ti.com/
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation version 2.
- *
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- * kind, whether express or implied; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#ifndef __OMAP3430_SDIODRV_API_H
-#define __OMAP3430_SDIODRV_API_H
-
-#include <asm/types.h>
-#include <linux/mmc/mmc.h>
-
-/* Card Common Control Registers (CCCR) */
-
-#define CCCR_SDIO_REVISION 0x00
-#define CCCR_SD_SPECIFICATION_REVISION 0x01
-#define CCCR_IO_ENABLE 0x02
-#define CCCR_IO_READY 0x03
-#define CCCR_INT_ENABLE 0x04
-#define CCCR_INT_PENDING 0x05
-#define CCCR_IO_ABORT 0x06
-#define CCCR_BUS_INTERFACE_CONTOROL 0x07
-#define CCCR_CARD_CAPABILITY 0x08
-#define CCCR_COMMON_CIS_POINTER 0x09 /*0x09-0x0B*/
-#define CCCR_FNO_BLOCK_SIZE 0x10 /*0x10-0x11*/
-#define FN0_CCCR_REG_32 0x64
-
-/* Pprotocol defined constants */
-
-#define SD_IO_GO_IDLE_STATE 0
-#define SD_IO_SEND_RELATIVE_ADDR 3
-#define SDIO_CMD5 5
-#define SD_IO_SELECT_CARD 7
-#define SDIO_CMD52 52
-#define SDIO_CMD53 53
-#define SD_IO_SEND_OP_COND SDIO_CMD5
-#define SD_IO_RW_DIRECT SDIO_CMD52
-#define SD_IO_RW_EXTENDED SDIO_CMD53
-#define SDIO_SHIFT(v,n) (v<<n)
-#define SDIO_RWFLAG(v) (SDIO_SHIFT(v,31))
-#define SDIO_FUNCN(v) (SDIO_SHIFT(v,28))
-#define SDIO_RAWFLAG(v) (SDIO_SHIFT(v,27))
-#define SDIO_BLKM(v) (SDIO_SHIFT(v,27))
-#define SDIO_OPCODE(v) (SDIO_SHIFT(v,26))
-#define SDIO_ADDRREG(v) (SDIO_SHIFT(v,9))
-
-
-#define VDD_VOLTAGE_WINDOW 0xffffc0
-#define FN2_OBI_INV 0x0002
-
-#define MMC_RSP_NONE (0 << 0)
-#define MMC_RSP_SHORT (1 << 0)
-#define MMC_RSP_LONG (2 << 0)
-#define MMC_RSP_MASK (3 << 0)
-#define MMC_RSP_CRC (1 << 3)
-#define MMC_RSP_BUSY (1 << 4)
-
-#define MMC_RSP_R1 (MMC_RSP_SHORT|MMC_RSP_CRC)
-#define MMC_RSP_R1B (MMC_RSP_SHORT|MMC_RSP_CRC|MMC_RSP_BUSY)
-#define MMC_RSP_R2 (MMC_RSP_LONG|MMC_RSP_CRC)
-#define MMC_RSP_R3 (MMC_RSP_SHORT)
-
-/* HSMMC controller bit definitions
- * */
-#define OMAP_HSMMC_CMD_NO_RESPONSE 0 << 0
-#define OMAP_HSMMC_CMD_LONG_RESPONSE 1 << 0
-#define OMAP_HSMMC_CMD_SHORT_RESPONSE 2 << 0
-
-#define MMC_ERR_NONE 0
-#define MMC_ERR_TIMEOUT 1
-#define MMC_ERR_BADCRC 2
-#define MMC_ERR_FIFO 3
-#define MMC_ERR_FAILED 4
-#define MMC_ERR_INVALID 5
-
-#undef MMC_RSP_R4
-#define MMC_RSP_R4 OMAP_HSMMC_CMD_SHORT_RESPONSE
-#undef MMC_RSP_R5
-#define MMC_RSP_R5 OMAP_HSMMC_CMD_SHORT_RESPONSE
-#undef MMC_RSP_R6
-#define MMC_RSP_R6 OMAP_HSMMC_CMD_SHORT_RESPONSE
-
-/********************************************************************/
-/* SDIO driver functions prototypes */
-/********************************************************************/
-int sdioDrv_ConnectBus (void * fCbFunc,
- void * hCbArg,
- unsigned int uBlkSizeShift,
- unsigned int uSdioThreadPriority,
- unsigned char **pTxDmaSrcAddr);
-
-int sdioDrv_DisconnectBus (void);
-
-int sdioDrv_ExecuteCmd (unsigned int uCmd,
- unsigned int uArg,
- unsigned int uRespType,
- void * pResponse,
- unsigned int uLen);
-
-int sdioDrv_ReadSync (unsigned int uFunc,
- unsigned int uHwAddr,
- void * pData,
- unsigned int uLen,
- unsigned int bIncAddr,
- unsigned int bMore);
-
-int sdioDrv_ReadAsync (unsigned int uFunc,
- unsigned int uHwAddr,
- void * pData,
- unsigned int uLen,
- unsigned int bBlkMode,
- unsigned int bIncAddr,
- unsigned int bMore);
-
-int sdioDrv_WriteSync (unsigned int uFunc,
- unsigned int uHwAddr,
- void * pData,
- unsigned int uLen,
- unsigned int bIncAddr,
- unsigned int bMore);
-
-int sdioDrv_WriteAsync (unsigned int uFunc,
- unsigned int uHwAddr,
- void * pData,
- unsigned int uLen,
- unsigned int bBlkMode,
- unsigned int bIncAddr,
- unsigned int bMore);
-
-int sdioDrv_ReadSyncBytes (unsigned int uFunc,
- unsigned int uHwAddr,
- unsigned char *pData,
- unsigned int uLen,
- unsigned int bMore);
-
-int sdioDrv_WriteSyncBytes (unsigned int uFunc,
- unsigned int uHwAddr,
- unsigned char *pData,
- unsigned int uLen,
- unsigned int bMore);
-
-void sdioDrv_register_pm(int (*wlanDrvIf_Start)(void),
- int (*wlanDrvIf_Stop)(void));
-
-
-#endif/* _OMAP3430_SDIODRV_H */
diff --git a/wilink_6_1/external_drivers/zoom2/Linux/sdio/SdioDrvDbg.h b/wilink_6_1/external_drivers/zoom2/Linux/sdio/SdioDrvDbg.h
deleted file mode 100644
index 0c0f06a..0000000
--- a/wilink_6_1/external_drivers/zoom2/Linux/sdio/SdioDrvDbg.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * SdioDrvDbg.h
- *
- * Copyright (C) 2009 Texas Instruments, Inc. - http://www.ti.com/
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation version 2.
- *
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- * kind, whether express or implied; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#ifndef OMAP3430_SDIODRV_DEBUG_H
-#define OMAP3430_SDIODRV_DEBUG_H
-
-#include <linux/kernel.h>
-
-typedef enum{
-SDIO_DEBUGLEVEL_EMERG=1,
-SDIO_DEBUGLEVEL_ALERT,
-SDIO_DEBUGLEVEL_CRIT,
-SDIO_DEBUGLEVEL_ERR=4,
-SDIO_DEBUGLEVEL_WARNING,
-SDIO_DEBUGLEVEL_NOTICE,
-SDIO_DEBUGLEVEL_INFO,
-SDIO_DEBUGLEVEL_DEBUG=8
-}sdio_debuglevel;
-
-extern int g_sdio_debug_level;
-
-#ifdef SDIO_DEBUG
-
-#define PERR(format, args... ) if(g_sdio_debug_level >= SDIO_DEBUGLEVEL_ERR) printk(format , ##args)
-#define PDEBUG(format, args... ) if(g_sdio_debug_level >= SDIO_DEBUGLEVEL_DEBUG) printk(format , ##args)
-#define PINFO(format, ... ) if(g_sdio_debug_level >= SDIO_DEBUGLEVEL_INFO) printk( format , ##__VA_ARGS__)
-#define PNOTICE(format, ... ) if(g_sdio_debug_level >= SDIO_DEBUGLEVEL_NOTICE) printk( format , ##__VA_ARGS__)
-#define PWARNING(format, ... ) if(g_sdio_debug_level >= SDIO_DEBUGLEVEL_WARNING) printk(format , ##__VA_ARGS__)
-
-#else
-
-#define PERR(format, args... ) if(g_sdio_debug_level >= SDIO_DEBUGLEVEL_ERR) printk(format , ##args)
-#define PDEBUG(format, args... )
-#define PINFO(format, ... )
-#define PNOTICE(format, ... )
-#define PWARNING(format, ... )
-
-#endif
-
-/* we want errors reported anyway */
-
-#define PERR1 PERR
-#define PERR2 PERR
-#define PERR3 PERR
-
-#endif /* OMAP3430_SDIODRV_DEBUG_H */
diff --git a/wilink_6_1/platforms/hw/host_platform_zoom2/linux/SdioAdapter.c b/wilink_6_1/platforms/hw/host_platform_zoom2/linux/SdioAdapter.c
deleted file mode 100644
index ea99e12..0000000
--- a/wilink_6_1/platforms/hw/host_platform_zoom2/linux/SdioAdapter.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- * SdioAdapter.c
- *
- * Copyright(c) 1998 - 2009 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.
- */
-
-
-/** \file SdioAdapter.c
- * \brief The SDIO driver adapter. Platform dependent.
- *
- * An adaptation layer between the lower SDIO driver (in BSP) and the upper SdioBusDrv.
- * Used for issuing all SDIO transaction types towards the lower SDIO-driver.
- * Makes the decision whether to use Sync or Async transaction, and reflects it to the caller
- * by the return value and calling its callback in case of Async.
- *
- * \see SdioAdapter.h, SdioDrv.c & h
- */
-
-#include "SdioDrvDbg.h"
-#include "TxnDefs.h"
-#include "SdioAdapter.h"
-#include "SdioDrv.h"
-#include "bmtrace_api.h"
-
-#ifdef SDIO_1_BIT /* see also in SdioDrv.c */
-#define SDIO_BITS_CODE 0x80 /* 1 bits */
-#else
-#define SDIO_BITS_CODE 0x82 /* 4 bits */
-#endif
-
-/* remove it after moving SdioAdapter into Sdio driver */
-int g_ssd_debug_level=4;
-
-/************************************************************************
- * Defines
- ************************************************************************/
-/* Sync/Async Threshold */
-#ifdef FULL_ASYNC_MODE
-#define SYNC_ASYNC_LENGTH_THRESH 0 /* Use Async for all transactions */
-#else
-#define SYNC_ASYNC_LENGTH_THRESH 360 /* Use Async for transactions longer than this threshold (in bytes) */
-#endif
-
-#define MAX_RETRIES 10
-
-/* For block mode configuration */
-#define FN0_FBR2_REG_108 0x210
-#define FN0_FBR2_REG_108_BIT_MASK 0xFFF
-
-int sdioDrv_clk_enable(void);
-void sdioDrv_clk_disable(void);
-
-int sdioAdapt_ConnectBus (void * fCbFunc,
- void * hCbArg,
- unsigned int uBlkSizeShift,
- unsigned int uSdioThreadPriority,
- unsigned char **pTxDmaSrcAddr)
-
-{
- unsigned char uByte;
- unsigned long uLong;
- unsigned long uCount = 0;
- unsigned int uBlkSize = 1 << uBlkSizeShift;
- int iStatus;
-
- if (uBlkSize < SYNC_ASYNC_LENGTH_THRESH)
- {
- PERR1("%s(): Block-Size should be bigger than SYNC_ASYNC_LENGTH_THRESH!!\n", __FUNCTION__ );
- }
-
- /* Init SDIO driver and HW */
- iStatus = sdioDrv_ConnectBus (fCbFunc, hCbArg, uBlkSizeShift,uSdioThreadPriority, pTxDmaSrcAddr);
- if (iStatus) { return iStatus; }
-
-
- /* Send commands sequence: 0, 5, 3, 7 */
- iStatus = sdioDrv_ExecuteCmd (SD_IO_GO_IDLE_STATE, 0, MMC_RSP_NONE, &uByte, sizeof(uByte));
- if (iStatus)
- {
- printk("%s %d command number: %d failed\n", __FUNCTION__, __LINE__, SD_IO_GO_IDLE_STATE);
- return iStatus;
- }
- iStatus = sdioDrv_ExecuteCmd (SDIO_CMD5, VDD_VOLTAGE_WINDOW, MMC_RSP_R4, &uByte, sizeof(uByte));
- if (iStatus) {
- printk("%s %d command number: %d failed\n", __FUNCTION__, __LINE__, SDIO_CMD5);
- return iStatus;
- }
-
- iStatus = sdioDrv_ExecuteCmd (SD_IO_SEND_RELATIVE_ADDR, 0, MMC_RSP_R6, &uLong, sizeof(uLong));
- if (iStatus) {
- printk("%s %d command number: %d failed\n", __FUNCTION__, __LINE__, SD_IO_SEND_RELATIVE_ADDR);
- return iStatus;
- }
- iStatus = sdioDrv_ExecuteCmd (SD_IO_SELECT_CARD, uLong, MMC_RSP_R6, &uByte, sizeof(uByte));
- if (iStatus) {
- printk("%s %d command number: %d failed\n", __FUNCTION__, __LINE__, SD_IO_SELECT_CARD);
- return iStatus;
- }
-
- /* NOTE:
- * =====
- * Each of the following loops is a workaround for a HW bug that will be solved in PG1.1 !!
- * Each write of CMD-52 to function-0 should use it as follows:
- * 1) Write the desired byte using CMD-52
- * 2) Read back the byte using CMD-52
- * 3) Write two dummy bytes to address 0xC8 using CMD-53
- * 4) If the byte read in step 2 is different than the written byte repeat the sequence
- */
-
- /* set device side bus width to 4 bit (for 1 bit write 0x80 instead of 0x82) */
- do
- {
- uByte = SDIO_BITS_CODE;
- iStatus = sdioDrv_WriteSyncBytes (TXN_FUNC_ID_CTRL, CCCR_BUS_INTERFACE_CONTOROL, &uByte, 1, 1);
- if (iStatus) { return iStatus; }
-
- iStatus = sdioDrv_ReadSyncBytes (TXN_FUNC_ID_CTRL, CCCR_BUS_INTERFACE_CONTOROL, &uByte, 1, 1);
- if (iStatus) { return iStatus; }
-
- iStatus = sdioDrv_WriteSync (TXN_FUNC_ID_CTRL, 0xC8, &uLong, 2, 1, 1);
- if (iStatus) { return iStatus; }
-
- uCount++;
-
- } while ((uByte != SDIO_BITS_CODE) && (uCount < MAX_RETRIES));
-
-
- uCount = 0;
-
- /* allow function 2 */
- do
- {
- uByte = 4;
- iStatus = sdioDrv_WriteSyncBytes (TXN_FUNC_ID_CTRL, CCCR_IO_ENABLE, &uByte, 1, 1);
- if (iStatus) { return iStatus; }
-
- iStatus = sdioDrv_ReadSyncBytes (TXN_FUNC_ID_CTRL, CCCR_IO_ENABLE, &uByte, 1, 1);
- if (iStatus) { return iStatus; }
-
- iStatus = sdioDrv_WriteSync (TXN_FUNC_ID_CTRL, 0xC8, &uLong, 2, 1, 1);
- if (iStatus) { return iStatus; }
-
- uCount++;
-
- } while ((uByte != 4) && (uCount < MAX_RETRIES));
-
-
-#ifdef SDIO_IN_BAND_INTERRUPT
-
- uCount = 0;
-
- do
- {
- uByte = 3;
- iStatus = sdioDrv_WriteSyncBytes (TXN_FUNC_ID_CTRL, CCCR_INT_ENABLE, &uByte, 1, 1);
- if (iStatus) { return iStatus; }
-
- iStatus = sdioDrv_ReadSyncBytes (TXN_FUNC_ID_CTRL, CCCR_INT_ENABLE, &uByte, 1, 1);
- if (iStatus) { return iStatus; }
-
- iStatus = sdioDrv_WriteSync (TXN_FUNC_ID_CTRL, 0xC8, &uLong, 2, 1, 1);
- if (iStatus) { return iStatus; }
-
- uCount++;
-
- } while ((uByte != 3) && (uCount < MAX_RETRIES));
-
-
-#endif
-
- uCount = 0;
-
- /* set block size for SDIO block mode */
- do
- {
- uLong = uBlkSize;
- iStatus = sdioDrv_WriteSync (TXN_FUNC_ID_CTRL, FN0_FBR2_REG_108, &uLong, 2, 1, 1);
- if (iStatus) { return iStatus; }
-
- iStatus = sdioDrv_ReadSync (TXN_FUNC_ID_CTRL, FN0_FBR2_REG_108, &uLong, 2, 1, 1);
- if (iStatus) { return iStatus; }
-
- iStatus = sdioDrv_WriteSync (TXN_FUNC_ID_CTRL, 0xC8, &uLong, 2, 1, 1);
- if (iStatus) { return iStatus; }
-
- uCount++;
-
- } while (((uLong & FN0_FBR2_REG_108_BIT_MASK) != uBlkSize) && (uCount < MAX_RETRIES));
-
-
- if (uCount >= MAX_RETRIES)
- {
- /* Failed to write CMD52_WRITE to function 0 */
- return (int)uCount;
- }
-
- return iStatus;
-}
-
-
-int sdioAdapt_DisconnectBus (void)
-{
- return sdioDrv_DisconnectBus ();
-}
-
-ETxnStatus sdioAdapt_Transact (unsigned int uFuncId,
- unsigned int uHwAddr,
- void * pHostAddr,
- unsigned int uLength,
- unsigned int bDirection,
- unsigned int bBlkMode,
- unsigned int bFixedAddr,
- unsigned int bMore)
-{
- int iStatus;
-
- /* If transction length is below threshold, use Sync methods */
- if (uLength < SYNC_ASYNC_LENGTH_THRESH)
- {
- /* Call read or write Sync method */
- if (bDirection)
- {
- CL_TRACE_START_L2();
- iStatus = sdioDrv_ReadSync (uFuncId, uHwAddr, pHostAddr, uLength, bFixedAddr, bMore);
- CL_TRACE_END_L2("tiwlan_drv.ko", "INHERIT", "SDIO", ".ReadSync");
- }
- else
- {
- CL_TRACE_START_L2();
- iStatus = sdioDrv_WriteSync (uFuncId, uHwAddr, pHostAddr, uLength, bFixedAddr, bMore);
- CL_TRACE_END_L2("tiwlan_drv.ko", "INHERIT", "SDIO", ".WriteSync");
- }
-
- /* If failed return ERROR, if succeeded return COMPLETE */
- if (iStatus)
- {
- return TXN_STATUS_ERROR;
- }
- return TXN_STATUS_COMPLETE;
- }
-
- /* If transction length is above threshold, use Async methods */
- else
- {
- /* Call read or write Async method */
- if (bDirection)
- {
- CL_TRACE_START_L2();
- iStatus = sdioDrv_ReadAsync (uFuncId, uHwAddr, pHostAddr, uLength, bBlkMode, bFixedAddr, bMore);
- CL_TRACE_END_L2("tiwlan_drv.ko", "INHERIT", "SDIO", ".ReadAsync");
- }
- else
- {
- CL_TRACE_START_L2();
- iStatus = sdioDrv_WriteAsync (uFuncId, uHwAddr, pHostAddr, uLength, bBlkMode, bFixedAddr, bMore);
- CL_TRACE_END_L2("tiwlan_drv.ko", "INHERIT", "SDIO", ".WriteAsync");
- }
-
- /* If failed return ERROR, if succeeded return PENDING */
- if (iStatus)
- {
- return TXN_STATUS_ERROR;
- }
- return TXN_STATUS_PENDING;
- }
-}
-
-ETxnStatus sdioAdapt_TransactBytes (unsigned int uFuncId,
- unsigned int uHwAddr,
- void * pHostAddr,
- unsigned int uLength,
- unsigned int bDirection,
- unsigned int bMore)
-{
- int iStatus;
-
- if(bMore == 1)
- {
- sdioDrv_clk_enable();
- }
-
- /* Call read or write bytes Sync method */
- if (bDirection)
- {
- iStatus = sdioDrv_ReadSyncBytes (uFuncId, uHwAddr, pHostAddr, uLength, bMore);
- }
- else
- {
- iStatus = sdioDrv_WriteSyncBytes (uFuncId, uHwAddr, pHostAddr, uLength, bMore);
- }
-
- if(bMore == 0)
- {
- sdioDrv_clk_disable();
- }
-
- /* If failed return ERROR, if succeeded return COMPLETE */
- if (iStatus)
- {
- return TXN_STATUS_ERROR;
- }
- return TXN_STATUS_COMPLETE;
-}
diff --git a/wilink_6_1/platforms/hw/host_platform_zoom2/linux/SdioAdapter.h b/wilink_6_1/platforms/hw/host_platform_zoom2/linux/SdioAdapter.h
deleted file mode 100644
index f824b53..0000000
--- a/wilink_6_1/platforms/hw/host_platform_zoom2/linux/SdioAdapter.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * SdioAdapter.h
- *
- * Copyright(c) 1998 - 2009 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.
- */
-
-/** \file SdioAdapter.h
- * \brief SDIO adapter module API definition
- *
- * \see SdioAdapter.c
- */
-
-#ifndef __SDIO_ADAPT_API_H__
-#define __SDIO_ADAPT_API_H__
-
-
-#include "TxnDefs.h"
-
-
-/************************************************************************
- * Defines
- ************************************************************************/
-
-/************************************************************************
- * Types
- ************************************************************************/
-
-/************************************************************************
- * Functions
- ************************************************************************/
-/** \brief sdioAdapt_ConnectBus: Init SDIO driver and HW
- *
- * \param fCbFunc - The bus driver's callback upon async transaction completion
- * \param hCbArg - The CB function handle
- * \param uBlkSizeShift - In block-mode: BlkSize = (1 << uBlkSizeShift)
- * \param uSdioThreadPriority - The SDIO interrupt handler thread priority
- * \return 0 = OK, otherwise = error
- *
- * \par Description
- * Called by BusDrv to initialize the SDIO driver and HW.
- *
- * \sa
- */
-int sdioAdapt_ConnectBus (void * fCbFunc,
- void * hCbArg,
- unsigned int uBlkSizeShift,
- unsigned int uSdioThreadPriority,
- unsigned char **pTxDmaSrcAddr);
-
-/** \brief sdioAdapt_DisconnectBus: Disconnect SDIO driver
- *
- * \param void
- * \return 0 = OK, otherwise = error
- *
- * \par Description
- * Called by BusDrv. Disconnect the SDIO driver.
- *
- * \sa
- */
-int sdioAdapt_DisconnectBus (void);
-/** \brief sdioAdapt_Transact: Process transaction
- *
- * \param uFuncId - SDIO function ID (1- BT, 2 - WLAN)
- * \param uHwAddr - HW address where to write the data
- * \param pHostAddr - The data buffer to write from or read into
- * \param uLength - The data length in bytes
- * \param bDirection - TRUE = Read, FALSE = Write
- * \param bBlkMode - If TRUE - use block mode
- * \param bMore - If TRUE, more transactions are expected so don't turn off any HW
- * \return COMPLETE if Txn completed in this context, PENDING if not, ERROR if failed
- *
- * \par Description
- * Called by the BusDrv module to issue an SDIO transaction.
- * Call write or read SDIO-driver function according to the direction.
- * Use Sync or Async method according to the transaction length
- *
- * \note It's assumed that this function is called only when idle (i.e. previous Txn is done).
- *
- * \sa
- */
-ETxnStatus sdioAdapt_Transact (unsigned int uFuncId,
- unsigned int uHwAddr,
- void * pHostAddr,
- unsigned int uLength,
- unsigned int bDirection,
- unsigned int bBlkMode,
- unsigned int bFixedAddr,
- unsigned int bMore);
-/** \brief sdioAdapt_TransactBytes: Process bytes transaction
- *
- * \param uFuncId - SDIO function ID (1- BT, 2 - WLAN)
- * \param uHwAddr - HW address where to write the data
- * \param pHostAddr - The data buffer to write from or read into
- * \param uLength - The data length in bytes
- * \param bDirection - TRUE = Read, FALSE = Write
- * \param bMore - If TRUE, more transactions are expected so don't turn off any HW
- * \return COMPLETE if Txn succeeded, ERROR if failed
- *
- * \par Description
- * Called by the BusDrv module to issue a bytes stream SDIO transaction.
- * Call write or read SDIO-driver Sync function according to the direction.
- *
- * \note It's assumed that this function is called only when idle (i.e. previous Txn is done).
- *
- * \sa
- */
-ETxnStatus sdioAdapt_TransactBytes (unsigned int uFuncId,
- unsigned int uHwAddr,
- void * pHostAddr,
- unsigned int uLength,
- unsigned int bDirection,
- unsigned int bMore);
-
-
-
-#endif /*__SDIO_ADAPT_API_H__*/
diff --git a/wilink_6_1/platforms/hw/host_platform_zoom2/linux/host_platform.c b/wilink_6_1/platforms/hw/host_platform_zoom2/linux/host_platform.c
deleted file mode 100644
index 35a9177..0000000
--- a/wilink_6_1/platforms/hw/host_platform_zoom2/linux/host_platform.c
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- * host_platform.c
- *
- * Copyright(c) 1998 - 2009 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 "tidef.h"
-#include <linux/kernel.h>
-#include <asm/io.h>
-#include <mach/tc.h>
-#include <linux/delay.h>
-
-#include "host_platform.h"
-#include "ioctl_init.h"
-#include "WlanDrvIf.h"
-#include "Device1273.h"
-
-
-#define OS_API_MEM_ADRR 0x0000000
-#define OS_API_REG_ADRR 0x300000
-#if 0 /* needed for first time new host ramp*/
-static void dump_omap_registers(void);
-#endif
-static void pad_config(unsigned long pad_addr, u32 andmask, u32 ormask)
-{
- int val;
- u32 *addr;
-
- addr = (u32 *) ioremap(pad_addr, 4);
- if (!addr) {
- printk(KERN_ERR "OMAP3430_pad_config: ioremap failed with addr %lx\n", pad_addr);
- return;
- }
-
- val = __raw_readl(addr);
- val &= andmask;
- val |= ormask;
- __raw_writel(val, addr);
-
- iounmap(addr);
-}
-
-static int OMAP3430_TNETW_Power(int power_on)
-{
- if (power_on) {
- gpio_set_value(PMENA_GPIO, 1);
- } else {
- gpio_set_value(PMENA_GPIO, 0);
- }
-
- return 0;
-}
-
-/*-----------------------------------------------------------------------------
-
-Routine Name:
-
- hPlatform_hardResetTnetw
-
-Routine Description:
-
- set the GPIO to low after awaking the TNET from ELP.
-
-Arguments:
-
- OsContext - our adapter context.
-
-
-Return Value:
-
- None
-
------------------------------------------------------------------------------*/
-
-int hPlatform_hardResetTnetw(void)
-{
- int err;
-
- /* Turn power OFF*/
- if ((err = OMAP3430_TNETW_Power(0)) == 0)
- {
- mdelay(500);
- /* Turn power ON*/
- err = OMAP3430_TNETW_Power(1);
- mdelay(50);
- }
- return err;
-
-} /* hPlatform_hardResetTnetw() */
-
-/* Turn device power off */
-int hPlatform_DevicePowerOff (void)
-{
- int err;
-
- err = OMAP3430_TNETW_Power(0);
-
- mdelay(10);
-
- return err;
-}
-
-
-/* Turn device power off according to a given delay */
-int hPlatform_DevicePowerOffSetLongerDelay(void)
-{
- int err;
-
- err = OMAP3430_TNETW_Power(0);
-
- mdelay(SDIO_ATTEMPT_LONGER_DELAY_LINUX);
-
- return err;
-}
-
-
-/* Turn device power on */
-int hPlatform_DevicePowerOn (void)
-{
- int err;
-
- err = OMAP3430_TNETW_Power(1);
-
- /* New Power Up Sequence */
- mdelay(15);
- err = OMAP3430_TNETW_Power(0);
- mdelay(1);
-
- err = OMAP3430_TNETW_Power(1);
-
- /* Should not be changed, 50 msec cause failures */
- mdelay(70);
-
- return err;
-}
-
-/*--------------------------------------------------------------------------------------*/
-
-int hPlatform_Wlan_Hardware_Init(void *tnet_drv)
-{
- TWlanDrvIfObj *drv = tnet_drv;
-
- drv->irq = TNETW_IRQ;
-
- /* choose gpio 101, pull up */
- /* Setting MUX Mode 4 , Pull bits 0 */
- /* Should set (x is don't change): xxxx xxxx xxxx xxxx xxxx xxxx xxx1 1000 */
- pad_config(CONTROL_PADCONF_CAM_D1, 0xFFE0FFFF, 0x001C0000);
-
- /* choose gpio 162, pull up, activated */
- /* Setting MUX Mode 4 , Pull bits 3 */
- /* Should set (x is don't change): xxxx xxxx xxxx xxxx xxxx xxxx xxx1 1100 */
- pad_config(CONTROL_PADCONF_MCBSP1_CLKX, 0xFFFFFFF0, 0x0000011C);
-
- /*
- * set pull up on all SDIO lines
- * Setting MUX Mode of 0, and pull bits to 3
- */
-
- /* set for mmc2_cmd - second half of the padconf register
- * Should set (x is don't change): xxxx xxxx xxx1 1000 xxxx xxxx xxxx xxxx */
- pad_config(CONTROL_PADCONF_MMC3_CMD, 0xFFFFFFF0, 0x0000011B);
-
- pad_config(CONTROL_PADCONF_MMC3_CLK, 0xFFF0FFE0,0x001C011A);
-
-
- /* set for mmc3_dat0 and dat1 - both parts of the padconf register
- * Should set (x is don't change): xxxx xxxx xxx1 1000 xxxx xxxx xxx1 1000 */
- pad_config(CONTROL_PADCONF_MMC3_DAT0, 0xFFF0FFF0, 0x011A011A);
-
- pad_config(CONTROL_PADCONF_MMC3_DAT2, 0xFFFFFFF0, 0x0000011A);
-
- pad_config(CONTROL_PADCONF_MMC3_DAT3, 0xFFF0FFFF, 0x011A0000);
-
-#define CONTROL_PADCONF_MMC2_DAT4 0x48002164 /* set AE4 to mmc2_dat4 set AH3 to mmc2_dat5 */
- pad_config(CONTROL_PADCONF_MMC2_DAT4, 0xFFF0FFF0, 0x00180018);
-
-#define CONTROL_PADCONF_MMC2_DAT6 0x48002168 /* set AF3 to mmc2_dat6 set AE3 to mmc2_dat7 */
- pad_config(CONTROL_PADCONF_MMC2_DAT6, 0xFFF0FFF0, 0x00180018);
-#if 0 /* needed for first time new host ramp*/
- dump_omap_registers();
-#endif
- return 0;
-}
-
-/*-----------------------------------------------------------------------------
-
-Routine Name:
-
- InitInterrupt
-
-Routine Description:
-
- this function init the interrupt to the Wlan ISR routine.
-
-Arguments:
-
- tnet_drv - Golbal Tnet driver pointer.
-
-
-Return Value:
-
- status
-
------------------------------------------------------------------------------*/
-
-int hPlatform_initInterrupt(void *tnet_drv, void* handle_add)
-{
- TWlanDrvIfObj *drv = tnet_drv;
- int rc;
-
- if (drv->irq == 0 || handle_add == NULL)
- {
- print_err("hPlatform_initInterrupt() bad param drv->irq=%d handle_add=0x%x !!!\n",drv->irq,(int)handle_add);
- return -EINVAL;
- }
- if ((rc = request_irq(drv->irq, handle_add, IRQF_TRIGGER_FALLING, drv->netdev->name, drv)))
- {
- print_err("TIWLAN: Failed to register interrupt handler\n");
- return rc;
- }
- return rc;
-
-} /* hPlatform_initInterrupt() */
-
-/*--------------------------------------------------------------------------------------*/
-
-void hPlatform_freeInterrupt(void *tnet_drv)
-{
- TWlanDrvIfObj *drv = tnet_drv;
-
- free_irq(drv->irq, drv);
-}
-
-/****************************************************************************************
- * hPlatform_hwGetRegistersAddr()
- ****************************************************************************************
-DESCRIPTION:
-
-ARGUMENTS:
-
-RETURN:
-
-NOTES:
-*****************************************************************************************/
-void *hPlatform_hwGetRegistersAddr(TI_HANDLE OsContext)
-{
- return (void*)OS_API_REG_ADRR;
-}
-
-/****************************************************************************************
- * hPlatform_hwGetMemoryAddr()
- ****************************************************************************************
-DESCRIPTION:
-
-ARGUMENTS:
-
-RETURN:
-
-NOTES:
-*****************************************************************************************/
-void *hPlatform_hwGetMemoryAddr(TI_HANDLE OsContext)
-{
- return (void*)OS_API_MEM_ADRR;
-}
-
-
-void hPlatform_Wlan_Hardware_DeInit(void)
-{
-}
-
-#if 0/* needed for first time new host ramp*/
-static void dump_omap_registers(void)
-{
- printk(KERN_ERR "AE10 which is 0x%x= 0x%x\n", CONTROL_PADCONF_MMC3_CMD, omap_readl( CONTROL_PADCONF_MMC3_CMD ));
- printk(KERN_ERR "AC3 which is addr 0x480021D0=%x\n", omap_readl( 0x480021D0 ));
-
- printk(KERN_ERR "DAT0 addr 0x%x value is =%x\n", CONTROL_PADCONF_MMC3_DAT0, omap_readl( CONTROL_PADCONF_MMC3_DAT0 ));
- printk(KERN_ERR "DAT2 addr 0x%x value is =%x\n", CONTROL_PADCONF_MMC3_DAT2, omap_readl( CONTROL_PADCONF_MMC3_DAT2 ));
- printk(KERN_ERR "DAT3 addr 0x%x value is =%x\n", CONTROL_PADCONF_MMC3_DAT3, omap_readl( CONTROL_PADCONF_MMC3_DAT3 ));
- printk(KERN_ERR "DAT4 addr 0x%x value is =%x\n", CONTROL_PADCONF_MMC2_DAT4, omap_readl( CONTROL_PADCONF_MMC2_DAT4 ));
- printk(KERN_ERR "DAT6 addr 0x%x value is =%x\n", CONTROL_PADCONF_MMC2_DAT6, omap_readl( CONTROL_PADCONF_MMC2_DAT6 ));
- printk(KERN_ERR "CAM_D1 addr 0x%x value is =%x\n", CONTROL_PADCONF_CAM_D1, omap_readl( CONTROL_PADCONF_CAM_D1 ));
- printk(KERN_ERR "MCBSP1_CLKX addr 0x%x value is =%x\n", CONTROL_PADCONF_MCBSP1_CLKX, omap_readl( CONTROL_PADCONF_MCBSP1_CLKX ));
- printk(KERN_ERR "CMD addr 0x%x value is =%x\n", CONTROL_PADCONF_MMC3_CMD, omap_readl( CONTROL_PADCONF_MMC3_CMD ));
- printk(KERN_ERR "MCBSP1_CLKX addr 0x%x value is =%x\n", CONTROL_PADCONF_MCBSP1_CLKX, omap_readl( CONTROL_PADCONF_MCBSP1_CLKX ));
- printk(KERN_ERR "CLK MCBSP1_CLKX addr 0x%x value is =%x\n", CONTROL_PADCONF_MMC3_CLK, omap_readl( CONTROL_PADCONF_MMC3_CLK ));
- printk(KERN_ERR "0x480021E0 value is =%x\n", omap_readl( 0x480021E0 ));
- return;
-}
-#endif
diff --git a/wilink_6_1/platforms/hw/host_platform_zoom2/linux/host_platform.h b/wilink_6_1/platforms/hw/host_platform_zoom2/linux/host_platform.h
deleted file mode 100644
index 8cbd8f1..0000000
--- a/wilink_6_1/platforms/hw/host_platform_zoom2/linux/host_platform.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * host_platform.h
- *
- * Copyright(c) 1998 - 2009 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.
- */
-
-/*--------------------------------------------------------------------------
- Module: host_platform_sdio.h
-
- Purpose: This module defines unified interface to the host platform specific
- sources and services.
-
---------------------------------------------------------------------------*/
-
-#ifndef __HOST_PLATFORM_SDIO__H__
-#define __HOST_PLATFORM_SDIO__H__
-
-#include <mach/hardware.h>
-
-//OMAP343X_CTRL_BASE = 0x48002000
-
-
-#define OMAP_HSMMC3_BASE 0x480AD000 //0x480b4000
-
-#define CONTROL_PADCONF_CAM_D1 0x48002118 /* WLAN_EN */
-#define CONTROL_PADCONF_MCBSP1_CLKX 0x48002198 /* WLAN_IRQ */
-
-#define CONTROL_PADCONF_MMC3_CLK 0x480025D8 /* mmc3_cmd */
-#define CONTROL_PADCONF_MMC3_CMD 0x480021D0 /* mmc3_cmd */
-
-#define CONTROL_PADCONF_MMC3_DAT0 0x480025E4 /* mmc3_dat0, mmc3_dat1 */
-#define CONTROL_PADCONF_MMC3_DAT2 0x480025E8 /* mmc3_dat2 */
-#define CONTROL_PADCONF_MMC3_DAT3 0x480025E0 /* mmc3_dat3 */
-
-#define INT_MMC3_IRQ 94
-
-#define PMENA_GPIO 101
-#define IRQ_GPIO 162
-
-//#include <asm/arch/hardware.h>
-
-#define MUXMODE_3 3
-#define TNETW_IRQ (OMAP_GPIO_IRQ(IRQ_GPIO))
-#define TIWLAN_IRQ_POLL_INTERVAL HZ/100
-#define HZ_IN_MSEC HZ/1000
-#define TIWLAN_IRQ_POLL_INTERVAL_MS TIWLAN_IRQ_POLL_INTERVAL/HZ_IN_MSEC
-
-int
-hPlatform_initInterrupt(
- void* tnet_drv,
- void* handle_add
- );
-
-void*
-hPlatform_hwGetRegistersAddr(
- TI_HANDLE OsContext
- );
-
-void*
-hPlatform_hwGetMemoryAddr(
- TI_HANDLE OsContext
- );
-
-void hPlatform_freeInterrupt(void *tnet_drv);
-
-int hPlatform_hardResetTnetw(void);
-int hPlatform_Wlan_Hardware_Init(void *tnet_drv);
-void hPlatform_Wlan_Hardware_DeInit(void);
-int hPlatform_DevicePowerOff(void);
-int hPlatform_DevicePowerOffSetLongerDelay(void);
-int hPlatform_DevicePowerOn(void);
-#endif /* __HOST_PLATFORM_SDIO__H__ */
diff --git a/wilink_6_1/platforms/os/linux/src/WlanDrvWext.c b/wilink_6_1/platforms/os/linux/src/WlanDrvWext.c
index afdd147..4eec78a 100644
--- a/wilink_6_1/platforms/os/linux/src/WlanDrvWext.c
+++ b/wilink_6_1/platforms/os/linux/src/WlanDrvWext.c
@@ -166,82 +166,86 @@ int wlanDrvWext_Handler (struct net_device *dev,
void *iw_req,
void *extra)
{
- int rc;
- TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev);
- ti_private_cmd_t my_command;
- struct iw_mlme mlme;
- void *copy_to_buf=NULL, *param3=NULL;
+ int rc;
+ TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev);
+ ti_private_cmd_t my_command;
+ struct iw_mlme mlme;
+ void *copy_to_buf=NULL, *param3=NULL;
- os_memoryZero(drv, &my_command, sizeof(ti_private_cmd_t));
- os_memoryZero(drv, &mlme, sizeof(struct iw_mlme));
-
- switch (info->cmd)
- {
- case SIOCIWFIRSTPRIV:
- {
- void *copy_from_buf;
+ os_memoryZero(drv, &my_command, sizeof(ti_private_cmd_t));
+ os_memoryZero(drv, &mlme, sizeof(struct iw_mlme));
- if (os_memoryCopyFromUser(drv, &my_command, ((union iwreq_data *)iw_req)->data.pointer, sizeof(ti_private_cmd_t)))
- {
- os_printf ("wlanDrvWext_Handler() os_memoryCopyFromUser FAILED !!!\n");
- return TI_NOK;
- }
- if (IS_PARAM_FOR_MODULE(my_command.cmd, DRIVER_MODULE_PARAM))
- {
- /* If it's a driver level command, handle it here and exit */
- switch (my_command.cmd)
- {
- case DRIVER_INIT_PARAM:
- return wlanDrvIf_LoadFiles (drv, my_command.in_buffer);
-
- case DRIVER_START_PARAM:
- return wlanDrvIf_Start (dev);
+ switch (info->cmd)
+ {
+ case SIOCIWFIRSTPRIV:
+ {
+ void *copy_from_buf;
- case DRIVER_STOP_PARAM:
- return wlanDrvIf_Stop (dev);
+ if (os_memoryCopyFromUser(drv, &my_command, ((union iwreq_data *)iw_req)->data.pointer, sizeof(ti_private_cmd_t)))
+ {
+ os_printf ("wlanDrvWext_Handler() os_memoryCopyFromUser FAILED !!!\n");
+ return TI_NOK;
+ }
+ if (IS_PARAM_FOR_MODULE(my_command.cmd, DRIVER_MODULE_PARAM))
+ {
+ /* If it's a driver level command, handle it here and exit */
+ switch (my_command.cmd)
+ {
+ case DRIVER_INIT_PARAM:
+ return wlanDrvIf_LoadFiles(drv, my_command.in_buffer);
- case DRIVER_STATUS_PARAM:
- *(TI_UINT32 *)my_command.out_buffer =
- (drv->tCommon.eDriverState == DRV_STATE_RUNNING) ? TI_TRUE : TI_FALSE;
- return TI_OK;
- }
- }
- /* if we are still here handle a normal private command*/
+ case DRIVER_START_PARAM:
+ return wlanDrvIf_Start(dev);
- if ((my_command.in_buffer) && (my_command.in_buffer_len))
- {
- copy_from_buf = my_command.in_buffer;
- my_command.in_buffer = os_memoryAlloc(drv, my_command.in_buffer_len);
- if (os_memoryCopyFromUser(drv, my_command.in_buffer, copy_from_buf, my_command.in_buffer_len))
- {
- os_printf ("wlanDrvWext_Handler() os_memoryCopyFromUser 1 FAILED !!!\n");
- return TI_NOK;
- }
- }
- if ((my_command.out_buffer) && (my_command.out_buffer_len))
- {
- copy_to_buf = my_command.out_buffer;
- my_command.out_buffer = os_memoryAlloc(drv, my_command.out_buffer_len);
- }
- param3 = &my_command;
- }
- break;
+ case DRIVER_STOP_PARAM:
+ return wlanDrvIf_Stop(dev);
- case SIOCSIWMLME:
- {
- os_memoryCopyFromUser(drv, &mlme, ((union iwreq_data *)iw_req)->data.pointer, sizeof(struct iw_mlme));
- param3 = &mlme;
- }
- break;
- }
- /* If the friver is not running, return NOK */
- if (drv->tCommon.eDriverState != DRV_STATE_RUNNING)
- {
- return TI_NOK;
- }
+ case DRIVER_STATUS_PARAM:
+ *(TI_UINT32 *)my_command.out_buffer =
+ (drv->tCommon.eDriverState == DRV_STATE_RUNNING) ? TI_TRUE : TI_FALSE;
+ return TI_OK;
+ }
+ }
+ /* if we are still here handle a normal private command*/
- /* Call the Cmd module with the given user paramters */
- rc = (cmdHndlr_InsertCommand (drv->tCommon.hCmdHndlr,
+ if ((my_command.in_buffer) && (my_command.in_buffer_len))
+ {
+ copy_from_buf = my_command.in_buffer;
+ my_command.in_buffer = os_memoryAlloc(drv, my_command.in_buffer_len);
+ if (os_memoryCopyFromUser(drv, my_command.in_buffer, copy_from_buf, my_command.in_buffer_len))
+ {
+ os_printf("wlanDrvWext_Handler() os_memoryCopyFromUser 1 FAILED !!!\n");
+ return TI_NOK;
+ }
+ }
+ if ((my_command.out_buffer) && (my_command.out_buffer_len))
+ {
+ copy_to_buf = my_command.out_buffer;
+ my_command.out_buffer = os_memoryAlloc(drv, my_command.out_buffer_len);
+ }
+ param3 = &my_command;
+ }
+ break;
+
+ case SIOCSIWMLME:
+ {
+ os_memoryCopyFromUser(drv, &mlme, ((union iwreq_data *)iw_req)->data.pointer, sizeof(struct iw_mlme));
+ param3 = &mlme;
+ }
+ break;
+ }
+ /* If the friver is not running, return NOK */
+ if (drv->tCommon.eDriverState != DRV_STATE_RUNNING)
+ {
+ if (my_command.in_buffer)
+ os_memoryFree(drv, my_command.in_buffer, my_command.in_buffer_len);
+ if (my_command.out_buffer)
+ os_memoryFree(drv,my_command.out_buffer,my_command.out_buffer_len);
+ return TI_NOK;
+ }
+
+ /* Call the Cmd module with the given user paramters */
+ rc = cmdHndlr_InsertCommand(drv->tCommon.hCmdHndlr,
info->cmd,
info->flags,
iw_req,
@@ -249,21 +253,20 @@ int wlanDrvWext_Handler (struct net_device *dev,
extra,
0,
param3,
- NULL));
- /* Here we are after the command was completed */
- if (my_command.in_buffer)
- {
- os_memoryFree (drv, my_command.in_buffer, my_command.in_buffer_len);
- }
- if (my_command.out_buffer)
- {
- if (os_memoryCopyToUser(drv, copy_to_buf, my_command.out_buffer, my_command.out_buffer_len))
- {
- os_printf ("wlanDrvWext_Handler() os_memoryCopyToUser FAILED !!!\n");
- rc = TI_NOK;
- }
- os_memoryFree (drv, my_command.out_buffer, my_command.out_buffer_len);
- }
-
- return rc;
+ NULL);
+ /* Here we are after the command was completed */
+ if (my_command.in_buffer)
+ {
+ os_memoryFree(drv, my_command.in_buffer, my_command.in_buffer_len);
+ }
+ if (my_command.out_buffer)
+ {
+ if (os_memoryCopyToUser(drv, copy_to_buf, my_command.out_buffer, my_command.out_buffer_len))
+ {
+ os_printf("wlanDrvWext_Handler() os_memoryCopyToUser FAILED !!!\n");
+ rc = TI_NOK;
+ }
+ os_memoryFree(drv, my_command.out_buffer, my_command.out_buffer_len);
+ }
+ return rc;
}
diff --git a/wilink_6_1/platforms/os/linux/src/osapi.c b/wilink_6_1/platforms/os/linux/src/osapi.c
index fd99089..8a84596 100644
--- a/wilink_6_1/platforms/os/linux/src/osapi.c
+++ b/wilink_6_1/platforms/os/linux/src/osapi.c
@@ -602,8 +602,8 @@ int os_wake_lock_timeout (TI_HANDLE OsContext)
int ret = 0;
unsigned long flags;
- spin_lock_irqsave(&drv->lock, flags);
if (drv) {
+ spin_lock_irqsave(&drv->lock, flags);
ret = drv->wl_packet;
if (drv->wl_packet) {
drv->wl_packet = 0;
@@ -611,8 +611,8 @@ int os_wake_lock_timeout (TI_HANDLE OsContext)
wake_lock_timeout(&drv->wl_rxwake, (HZ >> 1));
#endif
}
+ spin_unlock_irqrestore(&drv->lock, flags);
}
- spin_unlock_irqrestore(&drv->lock, flags);
/* printk("%s: %d\n", __func__, ret); */
return ret;
}
@@ -630,11 +630,13 @@ int os_wake_lock_timeout_enable (TI_HANDLE OsContext)
{
TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext;
unsigned long flags;
- int ret;
+ int ret = 0;
- spin_lock_irqsave(&drv->lock, flags);
- ret = drv->wl_packet = 1;
- spin_unlock_irqrestore(&drv->lock, flags);
+ if (drv) {
+ spin_lock_irqsave(&drv->lock, flags);
+ ret = drv->wl_packet = 1;
+ spin_unlock_irqrestore(&drv->lock, flags);
+ }
return ret;
}
@@ -653,16 +655,16 @@ int os_wake_lock (TI_HANDLE OsContext)
int ret = 0;
unsigned long flags;
- spin_lock_irqsave(&drv->lock, flags);
if (drv) {
+ spin_lock_irqsave(&drv->lock, flags);
#ifdef CONFIG_HAS_WAKELOCK
if (!drv->wl_count)
wake_lock(&drv->wl_wifi);
#endif
drv->wl_count++;
ret = drv->wl_count;
+ spin_unlock_irqrestore(&drv->lock, flags);
}
- spin_unlock_irqrestore(&drv->lock, flags);
/* printk("%s: %d\n", __func__, ret); */
return ret;
}
@@ -682,16 +684,18 @@ int os_wake_unlock (TI_HANDLE OsContext)
int ret = 0;
unsigned long flags;
- spin_lock_irqsave(&drv->lock, flags);
- if (drv && drv->wl_count) {
- drv->wl_count--;
+ if (drv) {
+ spin_lock_irqsave(&drv->lock, flags);
+ if (drv->wl_count) {
+ drv->wl_count--;
#ifdef CONFIG_HAS_WAKELOCK
- if (!drv->wl_count)
- wake_unlock(&drv->wl_wifi);
+ if (!drv->wl_count)
+ wake_unlock(&drv->wl_wifi);
#endif
- ret = drv->wl_count;
+ ret = drv->wl_count;
+ }
+ spin_unlock_irqrestore(&drv->lock, flags);
}
- spin_unlock_irqrestore(&drv->lock, flags);
/* printk("%s: %d\n", __func__, ret); */
return ret;
}
@@ -756,7 +760,10 @@ int os_SignalObjectWait (TI_HANDLE OsContext, void *signalObject)
{
if (!signalObject)
return TI_NOK;
- wait_for_completion ((struct completion *)signalObject);
+ if (!wait_for_completion_timeout((struct completion *)signalObject,
+ msecs_to_jiffies(10000))) {
+ printk("tiwlan: 10 sec %s timeout\n", __func__);
+ }
return TI_OK;
}
diff --git a/wilink_6_1/platforms/os/linux/zoom2_env.bash b/wilink_6_1/platforms/os/linux/zoom2_env.bash
index bf1addc..5d5d4a5 100644
--- a/wilink_6_1/platforms/os/linux/zoom2_env.bash
+++ b/wilink_6_1/platforms/os/linux/zoom2_env.bash
@@ -1,4 +1,4 @@
export CROSS_COMPILE=arm-eabi-
export ARCH=arm
export HOST_PLATFORM=zoom2
-export KERNEL_DIR=/usr/local/google/android/eclair/kernel
+export KERNEL_DIR=/usr/local/google/android/eclair-mr2/kernel
diff --git a/wilink_6_1/stad/src/Connection_Managment/admCtrlWpa.c b/wilink_6_1/stad/src/Connection_Managment/admCtrlWpa.c
index 3a92561..77041ba 100644
--- a/wilink_6_1/stad/src/Connection_Managment/admCtrlWpa.c
+++ b/wilink_6_1/stad/src/Connection_Managment/admCtrlWpa.c
@@ -1251,7 +1251,8 @@ TI_STATUS admCtrlWpa_parseIe(admCtrl_t *pAdmCtrl, TI_UINT8 *pWpaIe, wpaIeData_t
curWpaIe +=4;
/* Include all AP key management supported suites in the wpaData structure */
- pWpaData->KeyMngSuite[index+1] = curKeyMngSuite;
+ if ((index+1) < MAX_WPA_KEY_MNG_SUITES)
+ pWpaData->KeyMngSuite[index+1] = curKeyMngSuite;
}
pWpaData->KeyMngSuite[0] = maxKeyMngSuite;
diff --git a/wilink_6_1/stad/src/Connection_Managment/connInfra.c b/wilink_6_1/stad/src/Connection_Managment/connInfra.c
index 866b0fe..b48acdf 100644
--- a/wilink_6_1/stad/src/Connection_Managment/connInfra.c
+++ b/wilink_6_1/stad/src/Connection_Managment/connInfra.c
@@ -856,7 +856,7 @@ static TI_STATUS prepare_send_disconnect(void *pData)
/* Start the disconnect complete time out timer.
Disconect Complete event, which stops the timer. */
- tmr_StartTimer (pConn->hConnTimer, conn_timeout, (TI_HANDLE)pConn, DISCONNECT_TIMEOUT_MSEC * 4, TI_FALSE);
+ tmr_StartTimer (pConn->hConnTimer, conn_timeout, (TI_HANDLE)pConn, DISCONNECT_TIMEOUT_MSEC, TI_FALSE);
/* FW will send the disconn frame according to disConnType */
TWD_CmdFwDisconnect (pConn->hTWD, pConn->disConnType, pConn->disConnReasonToAP);
diff --git a/wilink_6_1/stad/src/Data_link/rx.c b/wilink_6_1/stad/src/Data_link/rx.c
index 52436fe..beb234f 100644
--- a/wilink_6_1/stad/src/Data_link/rx.c
+++ b/wilink_6_1/stad/src/Data_link/rx.c
@@ -39,28 +39,28 @@
/***************************************************************************/
#define __FILE_ID__ FILE_ID_54
#include "tidef.h"
-#include "paramOut.h"
+#include "paramOut.h"
#include "rx.h"
#include "osApi.h"
#include "timer.h"
#include "DataCtrl_Api.h"
#include "Ctrl.h"
#include "802_11Defs.h"
-#include "Ethernet.h"
+#include "Ethernet.h"
#include "report.h"
#include "rate.h"
#include "mlmeApi.h"
#include "rsnApi.h"
#include "smeApi.h"
#include "siteMgrApi.h"
-#include "GeneralUtil.h"
+#include "GeneralUtil.h"
#include "EvHandler.h"
#ifdef XCC_MODULE_INCLUDED
#include "XCCMngr.h"
#endif
#include "TWDriver.h"
#include "RxBuf.h"
-#include "DrvMainModules.h"
+#include "DrvMainModules.h"
#include "bmtrace_api.h"
#include "PowerMgr_API.h"
@@ -184,7 +184,7 @@ void rxData_init (TStadHandlesList *pStadHandles)
pRxData->hEvHandler = pStadHandles->hEvHandler;
pRxData->hTimer = pStadHandles->hTimer;
pRxData->hPowerMgr = pStadHandles->hPowerMgr;
-
+
pRxData->rxDataExcludeUnencrypted = DEF_EXCLUDE_UNENCYPTED;
pRxData->rxDataExludeBroadcastUnencrypted = DEF_EXCLUDE_UNENCYPTED;
pRxData->rxDataEapolDestination = DEF_EAPOL_DESTINATION;
@@ -239,7 +239,7 @@ TI_STATUS rxData_SetDefaults (TI_HANDLE hRxData, rxDataInitParams_t * rxDataInit
{
rxData_t *pRxData = (rxData_t *)hRxData;
int i;
-
+
/* init rx data filters */
pRxData->filteringEnabled = rxDataInitParams->rxDataFiltersEnabled;
pRxData->filteringDefaultAction = rxDataInitParams->rxDataFiltersDefaultAction;
@@ -814,7 +814,6 @@ static TI_STATUS rxData_addRxDataFilter (TI_HANDLE hRxData, TRxDataFilterRequest
lenFieldPatterns,
fieldPatterns);
- return TI_OK;
}
/***************************************************************************
diff --git a/wilink_6_1/wpa_supplicant_lib/driver_ti.c b/wilink_6_1/wpa_supplicant_lib/driver_ti.c
index 74a2d59..1e7b2a7 100644
--- a/wilink_6_1/wpa_supplicant_lib/driver_ti.c
+++ b/wilink_6_1/wpa_supplicant_lib/driver_ti.c
@@ -260,7 +260,7 @@ static int wpa_driver_tista_scan( void *priv, const u8 *ssid, size_t ssid_len )
struct wpa_supplicant *wpa_s = (struct wpa_supplicant *)(drv->ctx);
struct wpa_ssid *issid;
scan_Params_t scanParams;
- int scan_type, res, scan_probe_flag = 0;
+ int scan_type, res, timeout, scan_probe_flag = 0;
wpa_printf(MSG_DEBUG, "%s", __func__);
TI_CHECK_DRIVER( drv->driver_is_loaded, -1 );
@@ -298,6 +298,12 @@ static int wpa_driver_tista_scan( void *priv, const u8 *ssid, size_t ssid_len )
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);
+ eloop_cancel_timeout(wpa_driver_wext_scan_timeout, drv->wext, drv->ctx);
+ eloop_register_timeout(timeout, 0, wpa_driver_wext_scan_timeout,
+ drv->wext, drv->ctx);
return res;
#else
return wpa_driver_wext_scan(drv->wext, ssid, ssid_len);
@@ -578,7 +584,7 @@ Return Value: actual buffer length - success, -1 - failure
static int wpa_driver_tista_driver_cmd( void *priv, char *cmd, char *buf, size_t buf_len )
{
struct wpa_driver_ti_data *drv = (struct wpa_driver_ti_data *)priv;
- int ret = -1, prev_events;
+ int ret = -1, prev_events, flags;
wpa_printf(MSG_DEBUG, "%s %s", __func__, cmd);
@@ -596,6 +602,11 @@ static int wpa_driver_tista_driver_cmd( void *priv, char *cmd, char *buf, size_t
if( os_strcasecmp(cmd, "stop") == 0 ) {
wpa_printf(MSG_DEBUG,"Stop command");
+ if ((wpa_driver_wext_get_ifflags(drv->wext, &flags) == 0) &&
+ (flags & IFF_UP)) {
+ wpa_printf(MSG_ERROR, "TI: %s when iface is UP", cmd);
+ wpa_driver_wext_set_ifflags(drv->wext, flags & ~IFF_UP);
+ }
ret = wpa_driver_tista_driver_stop(priv);
if( ret == 0 ) {
drv->driver_is_loaded = FALSE;
@@ -665,14 +676,13 @@ static int wpa_driver_tista_driver_cmd( void *priv, char *cmd, char *buf, size_t
os_memcpy( (void *)buf, (void *)(cur_res->ssid), len );
ret = len;
ret += snprintf(&buf[ret], buf_len-len, " rssi %d\n", rssi);
- if (ret < (int)buf_len) {
- return( ret );
- }
}
}
}
else if( os_strcasecmp(cmd, "rssi") == 0 ) {
u8 ssid[MAX_SSID_LEN];
+ struct wpa_scan_result *cur_res;
+ struct wpa_supplicant *wpa_s = (struct wpa_supplicant *)(drv->ctx);
int rssi_data, rssi_beacon, len;
wpa_printf(MSG_DEBUG,"rssi command");
@@ -686,6 +696,12 @@ static int wpa_driver_tista_driver_cmd( void *priv, char *cmd, char *buf, size_t
ret = len;
ret += sprintf(&buf[ret], " rssi %d\n", rssi_beacon);
wpa_printf(MSG_DEBUG, "buf %s", buf);
+ /* Update cached value */
+ if( !wpa_s )
+ return( ret );
+ cur_res = scan_get_by_bssid( drv, wpa_s->bssid );
+ if( cur_res )
+ cur_res->level = rssi_beacon;
}
else
{