if (int_migration) { /* Set interrupt migration timer and * corresponding Tx/Rx counter. * timer 25ns*0xfa0=100us for 0xf packets.
* 0x306:Rx, 0x307:Tx */
rtl_write_dword(rtlpriv, REG_INT_MIG, 0xfe000fa0);
rtlpriv->dm.interrupt_migration = int_migration;
} else { /* Reset all interrupt migration settings. */
rtl_write_dword(rtlpriv, REG_INT_MIG, 0);
rtlpriv->dm.interrupt_migration = int_migration;
} break;
} case HW_VAR_INT_AC: { bool disable_ac_int = *((bool *) val);
/* Disable four ACs interrupts. */ if (disable_ac_int) { /* Disable VO, VI, BE and BK four AC interrupts * to gain more efficient CPU utilization. * When extremely highly Rx OK occurs, * we will disable Tx interrupts.
*/
rtlpriv->cfg->ops->update_interrupt_mask(hw, 0,
RT_AC_INT_MASKS);
rtlpriv->dm.disable_tx_int = disable_ac_int; /* Enable four ACs interrupts. */
} else {
rtlpriv->cfg->ops->update_interrupt_mask(hw,
RT_AC_INT_MASKS, 0);
rtlpriv->dm.disable_tx_int = disable_ac_int;
} break;
} default:
rtl92d_set_hw_reg(hw, variable, val); break;
}
}
/* 18. LLT_table_init(Adapter); */ for (i = 0; i < (txpktbuf_bndy - 1); i++) {
status = rtl92d_llt_write(hw, i, i + 1); if (!status) return status;
}
/* end of list */
status = rtl92d_llt_write(hw, (txpktbuf_bndy - 1), 0xFF); if (!status) return status;
/* Make the other pages as ring buffer */ /* This ring buffer is used as beacon buffer if we */ /* config this MAC as two MAC transfer. */ /* Otherwise used as local loopback buffer. */ for (i = txpktbuf_bndy; i < maxpage; i++) {
status = rtl92d_llt_write(hw, i, (i + 1)); if (!status) return status;
}
/* Let last entry point to the start entry of ring buffer */
status = rtl92d_llt_write(hw, maxpage, txpktbuf_bndy); if (!status) return status;
rtl92d_phy_set_poweron(hw); /* Add for resume sequence of power domain according
* to power document V11. Chapter V.11.... */ /* 0. RSV_CTRL 0x1C[7:0] = 0x00 */ /* unlock ISO/CLK/Power control register */
rtl_write_byte(rtlpriv, REG_RSV_CTRL, 0x00);
rtl_write_byte(rtlpriv, REG_LDOA15_CTRL, 0x05);
/* 1. AFE_XTAL_CTRL [7:0] = 0x0F enable XTAL */ /* 2. SPS0_CTRL 0x11[7:0] = 0x2b enable SPS into PWM mode */ /* 3. delay (1ms) this is not necessary when initially power on */
/* C. Resume Sequence */ /* a. SPS0_CTRL 0x11[7:0] = 0x2b */
rtl_write_byte(rtlpriv, REG_SPS0_CTRL, 0x2b);
/* b. AFE_XTAL_CTRL [7:0] = 0x0F */
rtl_write_byte(rtlpriv, REG_AFE_XTAL_CTRL, 0x0F);
/* c. DRV runs power on init flow */
/* auto enable WLAN */ /* 4. APS_FSMCO 0x04[8] = 1; wait till 0x04[8] = 0 */ /* Power On Reset for MAC Block */
bytetmp = rtl_read_byte(rtlpriv, REG_APS_FSMCO + 1) | BIT(0);
udelay(2);
rtl_write_byte(rtlpriv, REG_APS_FSMCO + 1, bytetmp);
udelay(2);
/* Enable Radio off, GPIO, and LED function */ /* 6. APS_FSMCO 0x04[15:0] = 0x0012 when enable HWPDN */
rtl_write_word(rtlpriv, REG_APS_FSMCO, 0x1012);
/* 20. HIMR 0x120[31:0] |= [enable INT mask bit map]; */ /* 21. HIMRE 0x128[7:0] = [enable INT mask bit map] */ /* The IMR should be enabled later after all init sequence
* is finished. */
/* 22. PCIE configuration space configuration */ /* 23. Ensure PCIe Device 0x80[15:0] = 0x0143 (ASPM+CLKREQ), */ /* and PCIe gated clock function is enabled. */ /* PCIE configuration space will be written after
* all init sequence.(Or by BIOS) */
rtl92d_phy_config_maccoexist_rfpage(hw);
/* THe below section is not related to power document Vxx . */ /* This is only useful for driver and OS setting. */ /* -------------------Software Relative Setting---------------------- */
wordtmp = rtl_read_word(rtlpriv, REG_TRXDMA_CTRL);
wordtmp &= 0xf;
wordtmp |= 0xF771;
rtl_write_word(rtlpriv, REG_TRXDMA_CTRL, wordtmp);
/* Reported Tx status from HW for rate adaptive. */ /* This should be realtive to power on step 14. But in document V11 */ /* still not contain the description.!!! */
rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 1, 0x1F);
/* Set Tx/Rx page size (Tx must be 128 Bytes,
* Rx can be 64,128,256,512,1024 bytes) */ /* rtl_write_byte(rtlpriv,REG_PBP, 0x11); */
rtl92d_phy_mac_config(hw); /* because last function modify RCR, so we update * rcr var here, or TP will unstable for receive_config * is wrong, RX RCR_ACRC32 will cause TP unstabel & Rx
* RCR_APP_ICV will cause mac80211 unassoc for cisco 1252*/
rtlpci->receive_config = rtl_read_dword(rtlpriv, REG_RCR);
rtlpci->receive_config &= ~(RCR_ACRC32 | RCR_AICV);
rtl92d_phy_bb_config(hw);
rtlphy->rf_mode = RF_OP_BY_SW_3WIRE; /* set before initialize RF */
rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER4, 0x00f00000, 0xf);
/* config RF */
rtl92d_phy_rf_config(hw);
/* After read predefined TXT, we must set BB/MAC/RF
* register as our requirement */ /* After load BB,RF params,we need do more for 92D. */
rtl92d_update_bbrf_configuration(hw); /* set default value after initialize RF, */
rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER4, 0x00f00000, 0);
rtlphy->rfreg_chnlval[0] = rtl_get_rfreg(hw, (enum radio_path)0,
RF_CHNLBW, RFREG_OFFSET_MASK);
rtlphy->rfreg_chnlval[1] = rtl_get_rfreg(hw, (enum radio_path)1,
RF_CHNLBW, RFREG_OFFSET_MASK);
/*---- Set CCK and OFDM Block "ON"----*/ if (rtlhal->current_bandtype == BAND_ON_2_4G)
rtl_set_bbreg(hw, RFPGA0_RFMOD, BCCKEN, 0x1);
rtl_set_bbreg(hw, RFPGA0_RFMOD, BOFDMEN, 0x1); if (rtlhal->interfaceindex == 0) { /* RFPGA0_ANALOGPARAMETER2: cck clock select,
* set to 20MHz by default */
rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(10) |
BIT(11), 3);
} else { /* Mac1 */
rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(11) |
BIT(10), 3);
}
/* Read EEPROM TX power index and PHY_REG_PG.txt to capture correct */ /* TX power index for different rate set. */
rtl92d_phy_get_hw_reg_originalvalue(hw);
rtl92d_phy_set_txpower_level(hw, rtlphy->current_channel);
if (ppsc->rfpwr_state == ERFON) {
rtl92d_phy_lc_calibrate(hw, IS_92D_SINGLEPHY(rtlhal->version)); /* 5G and 2.4G must wait sometime to let RF LO ready */ if (rtlhal->macphymode == DUALMAC_DUALPHY) {
u32 tmp_rega; for (i = 0; i < 10000; i++) {
udelay(MAX_STALL_TIME);
/* do iqk or reload iqk */ /* windows just rtl92d_phy_reload_iqk_setting in set channel, * but it's very strict for time sequence so we add
* rtl92d_phy_reload_iqk_setting here */ void rtl92d_linked_set_reg(struct ieee80211_hw *hw)
{ struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_phy *rtlphy = &(rtlpriv->phy);
u8 indexforchannel;
u8 channel = rtlphy->current_channel;
indexforchannel = rtl92d_get_rightchnlplace_for_iqk(channel); if (!rtlphy->iqk_matrix[indexforchannel].iqk_done) {
rtl_dbg(rtlpriv, COMP_SCAN | COMP_INIT, DBG_DMESG, "Do IQK for channel:%d\n", channel);
rtl92d_phy_iq_calibrate(hw);
}
}
/* n. SPS0_CTRL 0x11[7:0] = 0x22 enter PFM mode */
rtl_write_byte(rtlpriv, REG_SPS0_CTRL, 0x23);
/* o. AFE_XTAL_CTRL 0x24[7:0] = 0x0E disable XTAL, if No BT COEX */
rtl_write_byte(rtlpriv, REG_AFE_XTAL_CTRL, 0x0e);
/* p. RSV_CTRL 0x1C[7:0] = 0x0E lock ISO/CLK/Power control register */
rtl_write_byte(rtlpriv, REG_RSV_CTRL, 0x0e);
/* ==== interface into suspend === */
/* q. APS_FSMCO[15:8] = 0x58 PCIe suspend mode */ /* According to power document V11, we need to set this */ /* value as 0x18. Otherwise, we may not L0s sometimes. */ /* This indluences power consumption. Bases on SD1's test, */ /* set as 0x00 do not affect power current. And if it */ /* is set as 0x18, they had ever met auto load fail problem. */
rtl_write_byte(rtlpriv, REG_APS_FSMCO + 1, 0x10);
rtl_dbg(rtlpriv, COMP_INIT, DBG_LOUD, "In PowerOff,reg0x%x=%X\n",
REG_SPS0_CTRL, rtl_read_byte(rtlpriv, REG_SPS0_CTRL)); /* r. Note: for PCIe interface, PON will not turn */ /* off m-bias and BandGap in PCIe suspend mode. */
/* 0x17[7] 1b': power off in process 0b' : power off over */ if (rtlpriv->rtlhal.macphymode != SINGLEMAC_SINGLEPHY) {
spin_lock_irqsave(&globalmutex_power, flags);
u1b_tmp = rtl_read_byte(rtlpriv, REG_POWER_OFF_IN_PROCESS);
u1b_tmp &= (~BIT(7));
rtl_write_byte(rtlpriv, REG_POWER_OFF_IN_PROCESS, u1b_tmp);
spin_unlock_irqrestore(&globalmutex_power, flags);
}
if (rtlpci->driver_is_goingto_unload ||
ppsc->rfoff_reason > RF_CHANGE_BY_PS)
rtlpriv->cfg->ops->led_control(hw, LED_CTL_POWER_OFF);
RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); /* Power sequence for each MAC. */ /* a. stop tx DMA */ /* b. close RF */ /* c. clear rx buf */ /* d. stop rx DMA */ /* e. reset MAC */
/* Mac0 can not do Global reset. Mac1 can do. */ /* SYS_FUNC_EN 0x02[7:0] = 0xE0 reset BB state machine */ if (rtlpriv->rtlhal.interfaceindex == 1)
rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE0);
udelay(50);
/* d. stop tx/rx dma before disable REG_CR (0x100) to fix */ /* dma hang issue when disable/enable device. */
rtl_write_byte(rtlpriv, REG_PCIE_CTRL_REG + 1, 0xff);
udelay(50);
rtl_write_byte(rtlpriv, REG_CR, 0x0);
rtl_dbg(rtlpriv, COMP_INIT, DBG_LOUD, "==> Do power off.......\n"); if (rtl92d_phy_check_poweroff(hw))
_rtl92de_poweroff_adapter(hw); return;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.