static u8 _LLTRead( IN PADAPTER Adapter, IN u32 address ) { int count = 0; u32 value = _LLT_INIT_ADDR(address) | _LLT_OP(_LLT_READ_ACCESS); rtw_write32(Adapter, REG_LLT_INIT, value); //polling and get value do{ value = rtw_read32(Adapter, REG_LLT_INIT); if(_LLT_NO_ACTIVE == _LLT_OP_VALUE(value)){ return (u8)value; } if(count > POLLING_LLT_THRESHOLD){ //RT_TRACE(COMP_INIT,DBG_SERIOUS,("Failed to polling read LLT done at address %d!\n", address)); break; } }while(count++); return 0xFF; }
static s32 _LLTWrite(struct adapter *padapter, u32 address, u32 data) { s32 status = _SUCCESS; s32 count = 0; u32 value = _LLT_INIT_ADDR(address) | _LLT_INIT_DATA(data) | _LLT_OP(_LLT_WRITE_ACCESS); u16 LLTReg = REG_LLT_INIT; usb_write32(padapter, LLTReg, value); /* polling */ do { value = usb_read32(padapter, LLTReg); if (_LLT_NO_ACTIVE == _LLT_OP_VALUE(value)) break; if (count > POLLING_LLT_THRESHOLD) { RT_TRACE(_module_hal_init_c_, _drv_err_, ("Failed to polling write LLT done at address %d!\n", address)); status = _FAIL; break; } udelay(5); } while (count++); return status; }
//------------------------------------------------------------------------- // // LLT R/W/Init function // //------------------------------------------------------------------------- static u8 _LLTWrite( IN PADAPTER Adapter, IN u32 address, IN u32 data ) { u8 status = _SUCCESS; int count = 0; u32 value = _LLT_INIT_ADDR(address) | _LLT_INIT_DATA(data) | _LLT_OP(_LLT_WRITE_ACCESS); rtw_write32(Adapter, REG_LLT_INIT, value); //polling do{ value = rtw_read32(Adapter, REG_LLT_INIT); if(_LLT_NO_ACTIVE == _LLT_OP_VALUE(value)){ break; } if(count > POLLING_LLT_THRESHOLD){ //RT_TRACE(COMP_INIT,DBG_SERIOUS,("Failed to polling write LLT done at address %d!\n", address)); status = _FAIL; break; } }while(count++); return status; }
/** * writeLLT - LLT table write access * @io: io callback * @address: LLT logical address. * @data: LLT data content * * Realtek hardware access function. * */ bool rtl92c_llt_write(struct ieee80211_hw *hw, u32 address, u32 data) { struct rtl_priv *rtlpriv = rtl_priv(hw); bool status = true; long count = 0; u32 value = _LLT_INIT_ADDR(address) | _LLT_INIT_DATA(data) | _LLT_OP(_LLT_WRITE_ACCESS); rtl_write_dword(rtlpriv, REG_LLT_INIT, value); do { value = rtl_read_dword(rtlpriv, REG_LLT_INIT); if (_LLT_NO_ACTIVE == _LLT_OP_VALUE(value)) break; if (count > POLLING_LLT_THRESHOLD) { RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Failed to polling write LLT done at address %d! _LLT_OP_VALUE(%x)\n", address, _LLT_OP_VALUE(value)); status = false; break; } } while (++count); return status; }