1 /****************************************************************************
2 **+-----------------------------------------------------------------------+**
4 **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved. |**
5 **| All rights reserved. |**
7 **| Redistribution and use in source and binary forms, with or without |**
8 **| modification, are permitted provided that the following conditions |**
11 **| * Redistributions of source code must retain the above copyright |**
12 **| notice, this list of conditions and the following disclaimer. |**
13 **| * Redistributions in binary form must reproduce the above copyright |**
14 **| notice, this list of conditions and the following disclaimer in |**
15 **| the documentation and/or other materials provided with the |**
17 **| * Neither the name Texas Instruments nor the names of its |**
18 **| contributors may be used to endorse or promote products derived |**
19 **| from this software without specific prior written permission. |**
21 **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |**
22 **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |**
23 **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |**
24 **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |**
25 **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |**
26 **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |**
27 **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |**
28 **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |**
29 **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |**
30 **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |**
31 **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |**
33 **+-----------------------------------------------------------------------+**
34 ****************************************************************************/
36 #include <linux/module.h>
37 #include <linux/kernel.h>
38 #include <linux/version.h>
40 #include "mmc_tnetw1150_api.h"
44 #include "whalHwRegs.h"
50 struct sdio_func *SDIO_GetFunc( void );
53 /* Module parameters */
54 static char tiwlan_chip_id[10] = "na";
55 module_param_string(chip_id, tiwlan_chip_id, sizeof(tiwlan_chip_id), S_IWUSR | S_IRUGO);
56 MODULE_PARM_DESC(tiwlan_chip_id, "WiFi chip id");
57 static char fw_version[10] = "na";
58 module_param_string(fw_version, fw_version, sizeof(fw_version), S_IWUSR | S_IRUGO);
59 MODULE_PARM_DESC(fw_version, "WiFi firmware version");
61 /* export_wifi_fw_version
62 Exports WiFi firmware version to /sys/module/wlan/parameters/fw_version
65 int export_wifi_fw_version( tiwlan_net_dev_t *drv )
74 swLen = sizeof(swVer);
75 memset(&swVer, 0, swLen);
76 ret = UtilGetSwVersion(&drv->adapter, (unsigned char *)&swVer, &swLen);
80 fw_version[0] = swVer.FWVersion.major + 48;
82 fw_version[2] = swVer.FWVersion.minor + 48;
84 fw_version[4] = swVer.FWVersion.bugfix + 48;
86 fw_version[6] = swVer.FWVersion.subld + 48;
88 fw_version[8] = swVer.FWVersion.build + 48;
93 /* export_wifi_chip_id
94 Reads WiFi chip id (0x07030101) and prints it
97 int export_wifi_chip_id( void )
99 unsigned char chip_id[4];
101 #ifdef TIWLAN_MSM7000
103 struct sdio_func *func;
105 func = SDIO_GetFunc();
109 /* configure partition */
110 amap = SDIO_DOWNLOAD_PARTITION_START;
111 req.buffer = (unsigned char *)&amap;
113 req.peripheral_addr = 0x1ffc4;
114 SDIO_SyncWrite(func, &req);
116 amap = SDIO_DOWNLOAD_PARTITION_SIZE;
117 req.buffer = (unsigned char *)&amap;
119 req.peripheral_addr = 0x1ffc0;
120 SDIO_SyncWrite(func, &req);
122 amap = SDIO_REG_PARTITION_START;
123 req.buffer = (unsigned char *)&amap;
125 req.peripheral_addr = 0x1ffcc;
126 SDIO_SyncWrite(func, &req);
128 amap = SDIO_REG_PARTITION_SIZE;
129 req.buffer = (unsigned char *)&amap;
131 req.peripheral_addr = 0x1ffc8;
132 SDIO_SyncWrite(func, &req);
134 /* get TIWLAN1251 ID */
135 memset(chip_id, 0, 4);
136 req.buffer = chip_id;
138 req.peripheral_addr = SDIO_DOWNLOAD_PARTITION_SIZE + CHIP_ID; /* 0x1BE74 */
139 SDIO_SyncRead(func, &req);
141 #ifdef TIWLAN_OMAP1610
142 /* Can not be read on this stage - SDIO stack is not initialized yet */
143 amap = TNETW1251_CHIP_ID_PG1_2;
144 memcpy(chip_id, &amap, 4);
147 if ((chip_id[2] >= 1) && (chip_id[2] <= 3)){
148 tiwlan_chip_id[0] = '1';
149 tiwlan_chip_id[1] = '2';
150 tiwlan_chip_id[2] = '5';
151 tiwlan_chip_id[3] = '1';
152 tiwlan_chip_id[4] = 'P';
153 tiwlan_chip_id[5] = 'G';
154 tiwlan_chip_id[6] = '1';
155 tiwlan_chip_id[7] = '.';
159 tiwlan_chip_id[8] = '0';
160 printk("TIWLAN: 1251 PG 1.0\n");
163 tiwlan_chip_id[8] = '1';
164 printk("TIWLAN: 1251 PG 1.1\n");
167 tiwlan_chip_id[8] = '2';
168 printk("TIWLAN: 1251 PG 1.2\n");
171 printk("TIWLAN: invalid chip id = 0x%2x%2x%2x%2x!\n",
172 chip_id[3], chip_id[2], chip_id[1], chip_id[0]);