Home | History | Annotate | Download | only in Shm_Common
      1 /****************************************************************************
      2 **+-----------------------------------------------------------------------+**
      3 **|                                                                       |**
      4 **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved.      |**
      5 **| All rights reserved.                                                  |**
      6 **|                                                                       |**
      7 **| Redistribution and use in source and binary forms, with or without    |**
      8 **| modification, are permitted provided that the following conditions    |**
      9 **| are met:                                                              |**
     10 **|                                                                       |**
     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         |**
     16 **|    distribution.                                                      |**
     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.      |**
     20 **|                                                                       |**
     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.  |**
     32 **|                                                                       |**
     33 **+-----------------------------------------------------------------------+**
     34 ****************************************************************************/
     35 /**************************************************************************/
     36 /*                                                                        */
     37 /*   MODULE:  whalHwEeprom.c                                              */
     38 /*   PURPOSE: Wlan hardware EEPROM access routines implemenatation        */
     39 /*                                                                        */
     40 /**************************************************************************/
     41 #include "whalCommon.h"
     42 #include "whalHwDefs.h"
     43 #include "whalHwEeprom.h"
     44 #include "TNETWIF.h"
     45 
     46 
     47 /****************************************************************************
     48  *                      whal_hwEeprom_Create()
     49  ****************************************************************************
     50  * DESCRIPTION:	Create the wlan hardware eeprom access object
     51  *
     52  * INPUTS:
     53  *
     54  * OUTPUT:	None
     55  *
     56  * RETURNS:	The Created object
     57  ****************************************************************************/
     58 HwEeprom_T *whal_hwEeprom_Create(TI_HANDLE hOs)
     59 {
     60 	HwEeprom_T *pObj;
     61 
     62 	pObj = os_memoryAlloc(hOs, sizeof(HwEeprom_T));
     63 	if (pObj == NULL)
     64 		return NULL;
     65 
     66 	os_memoryZero(hOs, pObj, sizeof(HwEeprom_T));
     67 
     68 	pObj->hOs = hOs;
     69 
     70 	return(pObj);
     71 }
     72 
     73 /****************************************************************************
     74  *                      whal_hwEeprom_Destroy()
     75  ****************************************************************************
     76  * DESCRIPTION:	Destroy the object
     77  *
     78  * INPUTS:
     79  *		pHwEeprom		The object to free
     80  *
     81  * OUTPUT:	None
     82  *
     83  * RETURNS:	OK or NOK
     84  ****************************************************************************/
     85 int whal_hwEeprom_Destroy(HwEeprom_T *pHwEeprom)
     86 {
     87 	if (pHwEeprom)
     88 		os_memoryFree(pHwEeprom->hOs, pHwEeprom, sizeof(HwEeprom_T));
     89 	return OK;
     90 }
     91 
     92 /****************************************************************************
     93  *                      whal_hwEeprom_Config()
     94  ****************************************************************************
     95  * DESCRIPTION:	Config the object
     96  *
     97  * INPUTS:
     98  *		pHwEeprom		The object to free
     99  *		hTNETWIF		hardware access object
    100  *
    101  * OUTPUT:	None
    102  *
    103  * RETURNS:	OK or NOK
    104  ****************************************************************************/
    105 int whal_hwEeprom_Config(HwEeprom_T *pHwEeprom, TI_HANDLE hTNETWIF, TI_HANDLE hReport)
    106 {
    107 	pHwEeprom->hReport = hReport;
    108 	pHwEeprom->hTNETWIF = hTNETWIF;
    109 	return OK;
    110 }
    111 
    112 #ifdef USE_SYNC_API
    113 /************************************************************************
    114 *        UINT32 whal_hwEepromReadByte(UINT16 wAddr,UINT8 *pbVal)       *
    115 *************************************************************************
    116 * DESCRIPTION:  Reads a single byte from EEPROM.                        *
    117 *                                                                       *
    118 * INPUT:        wAddr - 16-bits EEPROM addrress                         *
    119 *               pbVal - pointer the to output parameter - EEPROM value  *
    120 *                                                                       *
    121 * OUTPUT:       *pbVal contains EEPROM value                            *
    122 *                                                                       *
    123 * RETURN:       OK - successful                                         *
    124 *               NOK  timeout                                            *
    125 *************************************************************************/
    126 UINT32 whal_hwEepromReadByte(HwEeprom_T *pHwEeprom, UINT16 wAddr,UINT8 *pbVal)
    127 {
    128 	UINT32 data;
    129 	int i = 0x00;
    130 
    131 
    132     wAddr &= 0x07ff;
    133     TNETWIF_WriteRegSync(pHwEeprom->hTNETWIF, ACX_EE_ADDR_REG,(UINT32)wAddr);
    134     TNETWIF_WriteRegSync(pHwEeprom->hTNETWIF, ACX_EE_CTL_REG, EE_READ);
    135     while((TNETWIF_ReadRegSync(pHwEeprom->hTNETWIF,ACX_EE_CTL_REG,&data) & EE_READ) != 0x00)
    136     {
    137         if(i++ > EEPROM_ACCESS_TO)
    138         {
    139             return NOK; /* timeout */
    140         }
    141     }
    142     *pbVal = TNETWIF_ReadRegSync(pHwEeprom->hTNETWIF,ACX_EE_DATA_REG,&data) & 0xff;
    143     return OK;
    144 }
    145 
    146 /************************************************************************
    147 *      UINT32 whal_hwEepromWriteByteNoUnp(UINT16 wAddr,UINT8 bVal)     *
    148 *************************************************************************
    149 * DESCRIPTION:  Writes a single byte to EEPROM                          *
    150 *                                                                       *
    151 * INPUT:        wAddr - 16-bits EEPROM addrress                         *
    152 *               bVal  - new value                                       *
    153 *                                                                       *
    154 * OUTPUT:       N/A                                                     *
    155 *                                                                       *
    156 * RETURN:       OK - successful                                         *
    157 *               NOK  timeout                                            *
    158 *************************************************************************/
    159 UINT32 whal_hwEepromWriteByteNoUnp(HwEeprom_T *pHwEeprom, UINT16 wAddr,UINT8 bVal)
    160 {
    161    volatile int i=0;
    162    UINT32 data;
    163 
    164    wAddr &= 0x07ff;
    165    TNETWIF_WriteRegSync(pHwEeprom->hTNETWIF, ACX_EE_ADDR_REG,(UINT32)wAddr);
    166    TNETWIF_WriteRegSync(pHwEeprom->hTNETWIF, ACX_EE_DATA_REG,bVal);
    167    TNETWIF_WriteRegSync(pHwEeprom->hTNETWIF, ACX_EE_CTL_REG, EE_WRITE);
    168    while((TNETWIF_ReadRegSync(pHwEeprom->hTNETWIF,ACX_EE_CTL_REG,&data)& EE_WRITE) != 0x00)
    169    {
    170 		volatile int y=0;
    171 
    172    	for( ; y<100; y++) {}
    173       if(i++ > EEPROM_ACCESS_TO)
    174       {
    175           return NOK; /* timeout */
    176       }
    177    }
    178 
    179    return OK;
    180 }
    181 
    182 /************************************************************************
    183 *           void whal_hwEepromProtect(void)                            *
    184 *************************************************************************
    185 * DESCRIPTION:  Set EEPROM write protection.                            *
    186 *               Inhibits writing to the EEPROM.                         *
    187 *                                                                       *
    188 * INPUT:        N/A                                                     *
    189 *                                                                       *
    190 * OUTPUT:       N/A                                                     *
    191 *                                                                       *
    192 * RETURN:       N/A                                                     *
    193 *************************************************************************/
    194 void whal_hwEepromProtect(HwEeprom_T *pHwEeprom)
    195 {
    196    /* Set up write protect. Should be according to board type and SW patch
    197       rather than according to Hardware EEPROM
    198    */
    199 	TNETWIF_RegIsBitSet(pHwEeprom->hTNETWIF, ACX_GPIO_OUT_REG, 1ul << 9);
    200 }
    201 
    202 /************************************************************************
    203 *           void whal_hwEepromUnprotect(void)                          *
    204 *************************************************************************
    205 * DESCRIPTION:  Remove EEPROM write protection.                         *
    206 *               Enables writing to the EEPROM.                          *
    207 *                                                                       *
    208 * INPUT:        N/A                                                     *
    209 *                                                                       *
    210 * OUTPUT:       N/A                                                     *
    211 *                                                                       *
    212 * RETURN:       N/A                                                     *
    213 *************************************************************************/
    214 void whal_hwEepromUnprotect(HwEeprom_T *pHwEeprom)
    215 {
    216     /* Turn off write protect. Should be according to board type and SW patch
    217       rather than according to Hardware EEPROM
    218    */
    219    	TNETWIF_RegResetBitVal(pHwEeprom->hTNETWIF, ACX_GPIO_OUT_REG, 1ul << 9);
    220 }
    221 
    222 /************************************************************************
    223 *          UINT32 whal_hwEepromWriteByte(UINT16 wAddr,UINT8 bVal)      *
    224 *************************************************************************
    225 * DESCRIPTION:  Writes a single byte to EEPROM                          *
    226 *                                                                       *
    227 * INPUT:        wAddr - 16-bits EEPROM addrress                         *
    228 *               bVal  - new value                                       *
    229 *                                                                       *
    230 * OUTPUT:       N/A                                                     *
    231 *                                                                       *
    232 * RETURN:       OK - successful                                         *
    233 *               NOK  timeout                                            *
    234 *************************************************************************/
    235 UINT32 whal_hwEepromWriteByte(HwEeprom_T *pHwEeprom, UINT16 wAddr,UINT8 bVal)
    236 {
    237 	UINT32 retCode;
    238 
    239    whal_hwEepromUnprotect(pHwEeprom);
    240 	os_StalluSec(pHwEeprom->hOs, 100000);
    241 	retCode = whal_hwEepromWriteByteNoUnp(pHwEeprom, wAddr, bVal);
    242 	os_StalluSec(pHwEeprom->hOs, 100000);
    243 	whal_hwEepromProtect(pHwEeprom);
    244    return retCode;
    245 }
    246 
    247 /************************************************************************
    248 *           UINT32 whal_hwEepromGetCalValue(UINT8 *pbVal)              *
    249 *************************************************************************
    250 * DESCRIPTION:  Reads oscillator cal. value from EEPROM                 *
    251 *                                                                       *
    252 * INPUT:        N/A                                                     *
    253 *                                                                       *
    254 * OUTPUT:       pbVal - pointer to the output parameter                 *
    255 *                                                                       *
    256 * RETURN:       OK   successful                                         *
    257 *               NOK  timeout                                            *
    258 *************************************************************************/
    259 UINT32 whal_hwEepromGetCalValue(HwEeprom_T *pHwEeprom, UINT8 *pbVal)
    260 {
    261     return whal_hwEepromReadByte(pHwEeprom, HW_EEPROM_OSC_ADDR,pbVal);
    262 }
    263 
    264 /************************************************************************
    265 *           UINT32 whal_hwEepromSetCalValue(UINT8 bVal)                *
    266 *************************************************************************
    267 * DESCRIPTION:  Writes new oscillator cal. value to EEPROM              *
    268 *                                                                       *
    269 * INPUT:        bVal - new oscillator cal. value                        *
    270 *                                                                       *
    271 * OUTPUT:       N/A                                                     *
    272 *                                                                       *
    273 * RETURN:       OK   successful                                         *
    274 *               NOK  timeout or invalid value                           *
    275 *************************************************************************/
    276 UINT32 whal_hwEepromSetCalValue(HwEeprom_T *pHwEeprom, UINT8 bVal)
    277 {
    278    if(bVal > MAX_OSC_CAL)
    279    {
    280       return NOK;
    281    }
    282 
    283    return whal_hwEepromWriteByte(pHwEeprom, HW_EEPROM_OSC_ADDR,bVal);
    284 }
    285 
    286 /************************************************************************
    287 *           UINT32 whal_hwEepromGetBiasValue(UINT8 *pbVal)             *
    288 *************************************************************************
    289 * DESCRIPTION:  Reads bias value from EEPROM                            *
    290 *                                                                       *
    291 * INPUT:        N/A                                                     *
    292 *                                                                       *
    293 * OUTPUT:       pbVal - pointer to the output parameter                 *
    294 *                                                                       *
    295 * RETURN:       OK   successful                                         *
    296 *               NOK  timeout                                            *
    297 *************************************************************************/
    298 UINT32 whal_hwEepromGetBiasValue(HwEeprom_T *pHwEeprom, UINT8 *pbVal)
    299 {
    300     return whal_hwEepromReadByte(pHwEeprom, HW_EEPROM_BIAS_ADDR,pbVal);
    301 }
    302 
    303 /************************************************************************
    304 *           UINT32 whal_hwEepromSetBiasValue(UINT8 bVal)               *
    305 *************************************************************************
    306 * DESCRIPTION:  Writes new bias value to EEPROM                         *
    307 *                                                                       *
    308 * INPUT:        bVal - new bias value                                   *
    309 *                                                                       *
    310 * OUTPUT:       N/A                                                     *
    311 *                                                                       *
    312 * RETURN:       OK   successful                                         *
    313 *               NOK  timeout                                            *
    314 *************************************************************************/
    315 UINT32 whal_hwEepromSetBiasValue(HwEeprom_T *pHwEeprom, UINT8 bVal)
    316 {
    317     return whal_hwEepromWriteByte(pHwEeprom, HW_EEPROM_BIAS_ADDR,bVal);
    318 }
    319 
    320 /************************************************************************
    321 *           UINT32 whal_hwEepromGetDACValue(UINT8 *pbVal)              *
    322 *************************************************************************
    323 * DESCRIPTION:  Reads DAC value from EEPROM                             *
    324 *                                                                       *
    325 * INPUT:        N/A                                                     *
    326 *                                                                       *
    327 * OUTPUT:       pbVal - pointer to the output parameter                 *
    328 *                                                                       *
    329 * RETURN:       OK   successful                                         *
    330 *               NOK  timeout                                            *
    331 *************************************************************************/
    332 UINT32 whal_hwEepromGetDACValue(HwEeprom_T *pHwEeprom, UINT8 *pbVal)
    333 {
    334     return whal_hwEepromReadByte(pHwEeprom, HW_EEPROM_DAC_ADDR,pbVal);
    335 }
    336 
    337 /************************************************************************
    338 *           UINT32 whal_hwEepromSetDACValue(UINT8 bVal)                *
    339 *************************************************************************
    340 * DESCRIPTION:  Writes new DAC value to EEPROM                          *
    341 *                                                                       *
    342 * INPUT:        bVal - new DAC value                                    *
    343 *                                                                       *
    344 * OUTPUT:       N/A                                                     *
    345 *                                                                       *
    346 * RETURN:       OK   successful                                         *
    347 *               NOK  timeout                                            *
    348 *************************************************************************/
    349 UINT32 whal_hwEepromSetDACValue(HwEeprom_T *pHwEeprom, UINT8 bVal)
    350 {
    351     return whal_hwEepromWriteByte(pHwEeprom, HW_EEPROM_DAC_ADDR,bVal);
    352 }
    353 
    354 /************************************************************************
    355 *           int whal_hwEepromLoadBaseBandTable(void)                   *
    356 *************************************************************************
    357 * DESCRIPTION:  Loads BB registers table from EEPROM                    *
    358 *                                                                       *
    359 * INPUT:        N/A                                                     *
    360 *                                                                       *
    361 * OUTPUT:       N/A                                                     *
    362 *                                                                       *
    363 * RETURN:       N/A                                                     *
    364 *************************************************************************/
    365 int whal_hwEepromLoadBaseBandTable(HwEeprom_T *pHwEeprom)
    366 {
    367    UINT8   bRegVal;
    368    UINT16  wTableAddress;
    369    UINT8   bNumberOfEntries;
    370    UINT16  wTableEnd;
    371    UINT8   bEntrySize;
    372    UINT8   bbAddr;
    373    UINT8   bbData;
    374    int addr;
    375 
    376    if(whal_hwEepromReadByte(pHwEeprom, 0x14a,&bRegVal) != OK)
    377    {
    378 		return NOK;
    379    }
    380 
    381    wTableAddress = bRegVal;
    382 
    383    if(whal_hwEepromReadByte(pHwEeprom, 0x14b,&bRegVal) != OK)
    384    {
    385 		return NOK;
    386    }
    387 
    388    wTableAddress |= bRegVal << 8;
    389 
    390    if(whal_hwEepromReadByte(pHwEeprom, wTableAddress,&bRegVal) != OK)
    391    {
    392    }
    393 
    394    bNumberOfEntries = bRegVal;
    395 
    396    if(whal_hwEepromReadByte(pHwEeprom, (UINT16)(wTableAddress+1),&bRegVal) != OK)
    397    {
    398       return NOK;
    399    }
    400 
    401    bEntrySize = bRegVal;
    402 
    403 	WLAN_REPORT_INFORMATION(pHwEeprom->hReport, HAL_HW_CTRL_MODULE_LOG,
    404 		("\tTable Address: 0x%x\n\tNumber of elements: 0x%x\n\tEntry Size: 0x%x\n",
    405                         wTableAddress,bNumberOfEntries,bEntrySize));
    406 
    407 
    408    wTableEnd = wTableAddress + (bEntrySize * (bNumberOfEntries + 1));
    409 
    410    for(addr = wTableAddress + 2; addr < wTableEnd; addr+= bEntrySize)
    411    {
    412       if(whal_hwEepromReadByte(pHwEeprom, (UINT16)addr,&bbAddr)!= OK)
    413       {
    414 			return NOK;
    415       }
    416 
    417       if(whal_hwEepromReadByte(pHwEeprom, (UINT16)(addr+1),&bbData)!= OK)
    418       {
    419          return NOK;
    420       }
    421 
    422       /*
    423       whal_hwWritePHYReg(bbAddr,bbData);
    424       -- the follwing 3 statements do the same thing
    425       */
    426 	   TNETWIF_WriteRegSync(pHwEeprom->hTNETWIF, ACX_PHY_ADDR_REG, bbAddr);
    427 	   TNETWIF_WriteRegSync(pHwEeprom->hTNETWIF, ACX_PHY_DATA_REG, bbData);
    428 	   TNETWIF_WriteRegSync(pHwEeprom->hTNETWIF, ACX_PHY_CTRL_REG, 1 /* write */);
    429    }
    430    return OK;
    431 }/* END whal_hwEepromLoadBaseBandTable() */
    432 
    433 /************************************************************************
    434 *   UINT32 whal_hwEepromGetAGCCell(UINT8 bTableOffset, UINT8 *pbVal)   *
    435 *************************************************************************
    436 * DESCRIPTION:  Reads one cell from ACG table                           *
    437 *                                                                       *
    438 * INPUT:        bTableOffset - zero-based offset of the cell in AGC     *
    439 *                              table                                    *
    440 * OUTPUT:       pbVal - pointer to the output parameter                 *
    441 *                                                                       *
    442 * RETURN:       OK                                                      *
    443 *               NOK - EEPROM write error                                *
    444 *               INVALID_PARAMETER1 - invalid parameter 1                *
    445 *************************************************************************/
    446 UINT32 whal_hwEepromGetAGCCell(HwEeprom_T *pHwEeprom, UINT8 bTableOffset, UINT8 *pbVal)
    447 {
    448     if(bTableOffset > MAX_AGC_TABLE_ENTRIES)
    449     {
    450         *pbVal = 0x00;
    451         return (UINT32)INVALID_PARAMETER1;
    452     }
    453 
    454     return whal_hwEepromReadByte(pHwEeprom, (UINT16)(HW_EEPROM_AGC_TABLE_ADDR+bTableOffset),pbVal);
    455 }
    456 
    457 /************************************************************************
    458 *   UINT32 whal_hwEepromSetAGCCell(UINT8 bTableOffset, UINT8 bVal)     *
    459 *************************************************************************
    460 * DESCRIPTION:  Writes one AGC table cell to EEPROM                     *
    461 *                                                                       *
    462 * INPUT:        bTableOffset - zero-based offset of the cell in AGC     *
    463 *                              table                                    *
    464 *               bVal         - new cell value                           *
    465 * OUTPUT:       N/A                                                     *
    466 *                                                                       *
    467 * RETURN:       OK                                                      *
    468 *               NOK - EEPROM write error                                *
    469 *               INVALID_PARAMETER1 - invalid parameter 1                *
    470 *************************************************************************/
    471 UINT32 whal_hwEepromSetAGCCell(HwEeprom_T *pHwEeprom, UINT8 bTableOffset, UINT8 bVal)
    472 {
    473     if(bTableOffset > MAX_AGC_TABLE_ENTRIES)
    474     {
    475         return (UINT32)INVALID_PARAMETER1;
    476     }
    477 
    478     return whal_hwEepromWriteByte(pHwEeprom, (UINT16)(HW_EEPROM_AGC_TABLE_ADDR+bTableOffset), bVal);
    479 }
    480 
    481 
    482 
    483 /****************************************************************************
    484  *                      whal_hwCtrl_GetRadioTypeAndEEPROMversion()
    485  ****************************************************************************
    486  * DESCRIPTION:
    487  *
    488  * INPUTS:  None
    489  *
    490  * OUTPUT:	None
    491  *
    492  * RETURNS:	OK or NOK
    493  ****************************************************************************/
    494 int whal_hwEeprom_GetRadioTypeAndEEPROMversion(HwEeprom_T *pHwEeprom, UINT32 *major, UINT32 *minor, UINT32 *bugfix)
    495 {
    496 	/*volatile */
    497 UINT32    radioType;
    498 
    499 	/*volatile */
    500 UINT32 eectl;
    501 	/*
    502 	 * Read major eeprom version - offset 5
    503 	 */
    504 	TNETWIF_WriteRegSync( pHwEeprom->hTNETWIF, EE_ADDR, 5);
    505 	TNETWIF_WriteRegSync( pHwEeprom->hTNETWIF, EE_CTL,  0x2);
    506 	do
    507 	{
    508 		TNETWIF_ReadRegSync(pHwEeprom->hTNETWIF,EE_CTL,&eectl);
    509 		if (eectl == 0xffffffff)
    510 			return -1;
    511 	} while (eectl &0x2);
    512 	TNETWIF_ReadRegSync(pHwEeprom->hTNETWIF,EE_DATA,major);
    513 	/*
    514 	 * Read minor eeprom version - offset 9
    515 	 */
    516 	TNETWIF_WriteRegSync( pHwEeprom->hTNETWIF, EE_ADDR, 9);
    517 	TNETWIF_WriteRegSync( pHwEeprom->hTNETWIF, EE_CTL,  0x2);
    518 	do
    519 	{
    520 		TNETWIF_ReadRegSync(pHwEeprom->hTNETWIF,EE_CTL,&eectl);
    521 		if (eectl == 0xffffffff)
    522 			return -1;
    523 	} while (eectl &0x2);
    524 	TNETWIF_ReadRegSync(pHwEeprom->hTNETWIF,EE_DATA,minor);
    525 
    526 	/*
    527 	 * Read bugfix eeprom version - offset A
    528 	 */
    529 	TNETWIF_WriteRegSync( pHwEeprom->hTNETWIF, EE_ADDR, 0xA);
    530 	TNETWIF_WriteRegSync( pHwEeprom->hTNETWIF, EE_CTL,  0x2);
    531 	do
    532 	{
    533 		TNETWIF_ReadRegSync(pHwEeprom->hTNETWIF,EE_CTL,&eectl);
    534 		if (eectl == 0xffffffff)
    535 			return -1;
    536 	} while (eectl &0x2);
    537 	TNETWIF_ReadRegSync(pHwEeprom->hTNETWIF,EE_DATA,bugfix);
    538 
    539 	/*
    540 	 * Read radio type - offset 4
    541 	 */
    542 	TNETWIF_WriteRegSync( pHwEeprom->hTNETWIF, EE_ADDR, 4);
    543 	TNETWIF_WriteRegSync( pHwEeprom->hTNETWIF, EE_CTL,  0x2);
    544 	do
    545 	{
    546 		TNETWIF_ReadRegSync(pHwEeprom->hTNETWIF,EE_CTL,&eectl);
    547 		if (eectl == 0xffffffff)
    548 			return -1;
    549 	} while (eectl &0x2);
    550 
    551 	TNETWIF_ReadRegSync(pHwEeprom->hTNETWIF,EE_DATA,&radioType);
    552 
    553 	return(int)radioType;
    554 }
    555 
    556 void whal_hwEeprom_DumpEEPROM(HwEeprom_T *pHwEeprom)
    557 {
    558 	UINT16 wAddr;
    559 	UINT8  bVal;
    560 
    561 	WLAN_REPORT_REPLY(pHwEeprom->hReport, HAL_HW_CTRL_MODULE_LOG,
    562 		("Dump EEPROM contents:"));
    563 	for ( wAddr = 0; wAddr < 0x2ff; wAddr++)
    564 	{
    565 		if (whal_hwEepromReadByte(pHwEeprom, wAddr, &bVal) == OK)
    566 		{
    567 			WLAN_REPORT_REPLY(pHwEeprom->hReport, HAL_HW_CTRL_MODULE_LOG,
    568 							  ("\tEEPROM 0x%04X:\t0x%02X.\n", wAddr, bVal));
    569 		} else
    570 		{
    571 			WLAN_REPORT_REPLY(pHwEeprom->hReport, HAL_HW_CTRL_MODULE_LOG,
    572 							  ("\tERROR: timeout"));
    573 		}
    574 	}
    575 }
    576 
    577 #endif /* USE_SYNC_API */
    578