aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-12-15 18:06:13 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-15 18:06:13 -0800
commitdab363f938a53ddaee60bfecc1aebdbb3d3af5f0 (patch)
treeccdb11a6e6191ba71fbc7716714c47b79172070d /drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c
parentMerge tag 'firewire-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394 (diff)
parentStaging: slicoss: Fix long line issues in slicoss.c (diff)
downloadlinux-dev-dab363f938a53ddaee60bfecc1aebdbb3d3af5f0.tar.xz
linux-dev-dab363f938a53ddaee60bfecc1aebdbb3d3af5f0.zip
Merge tag 'staging-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging driver updates from Greg KH: "Here's the big staging tree pull request for 3.19-rc1. We continued to delete more lines than were added, always a good thing, but not at a huge rate this release, only about 70k lines removed overall mostly from removing the horrid bcm driver. Lots of normal staging driver cleanups and fixes all over the place, well over a thousand of them, the shortlog shows all the horrid details. The "contentious" thing here is the movement of the Android binder code out of staging into the "real" part of the kernel. This is code that has been stable for a few years now and is working as-is in the tens of millions of devices with no issues. Yes, the code is horrid, and the userspace api leaves a lot to be desired, but it's not going to change due to legacy issues that we have no control over. Because so many devices and companies rely on this, and the code is stable, might as well promote it out of staging. This was all discussed at the Linux Plumbers conference, and everyone participating agreed that this was the best way forward. There is work happening to replace the binder code with something new that is happening right now, but I don't expect to see the results of that work for another year at the earliest. If that ever happens, and Android switches over to it, I'll gladly remove this version. As for maintainers, I'll be glad to maintain this code, I've been doing it for the past few years with no problems. I'll send a MAINTAINERS entry for it before 3.19-final is out, still need to talk to the Google developers about if they are willing to help with it or not, last I checked they were, which was good. All of these patches have been in linux-next for a while with no reported issues" * tag 'staging-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (1382 commits) Staging: slicoss: Fix long line issues in slicoss.c staging: rtl8712: remove unnecessary else after return staging: comedi: change some printk calls to pr_err staging: rtl8723au: hal: Removed the extra semicolon lustre: Deletion of unnecessary checks before three function calls staging: lustre: fix sparse warnings: static function declaration staging: lustre: fixed sparse warnings related to static declarations staging: unisys: remove duplicate header staging: unisys: remove unneeded structure staging: ft1000 : replace __attribute ((__packed__) with __packed drivers: staging: rtl8192e: Include "asm/unaligned.h" instead of "access_ok.h" in "rtl819x_BAProc.c" Drivers:staging:rtl8192e: Fixed checkpatch warning Drivers:staging:clocking-wizard: Added a newline staging: clocking-wizard: check for a valid clk_name pointer staging: rtl8723au: Hal_InitPGData() avoid unnecessary typecasts staging: rtl8723au: _DisableAnalog(): Avoid zero-init variables unnecessarily staging: rtl8723au: Remove unnecessary wrapper _ResetDigitalProcedure1() staging: rtl8723au: _ResetDigitalProcedure1_92C() reduce code obfuscation staging: rtl8723au: Remove unnecessary wrapper _DisableRFAFEAndResetBB() staging: rtl8723au: _DisableRFAFEAndResetBB8192C(): Reduce code obfuscation ...
Diffstat (limited to 'drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c')
-rw-r--r--drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c493
1 files changed, 73 insertions, 420 deletions
diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c
index 8523908d5e5f..a5eadd4e2580 100644
--- a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c
+++ b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c
@@ -47,29 +47,19 @@ static void _FWDownloadEnable(struct rtw_adapter *padapter, bool enable)
}
}
-static int _BlockWrite(struct rtw_adapter *padapter, void *buffer, u32 buffSize)
-{
- int ret;
-
- if (buffSize > MAX_PAGE_SIZE)
- return _FAIL;
-
- ret = rtl8723au_writeN(padapter, FW_8723A_START_ADDRESS,
- buffSize, buffer);
-
- return ret;
-}
-
static int
_PageWrite(struct rtw_adapter *padapter, u32 page, void *buffer, u32 size)
{
u8 value8;
u8 u8Page = (u8) (page & 0x07);
+ if (size > MAX_PAGE_SIZE)
+ return _FAIL;
+
value8 = (rtl8723au_read8(padapter, REG_MCUFWDL + 2) & 0xF8) | u8Page;
rtl8723au_write8(padapter, REG_MCUFWDL + 2, value8);
- return _BlockWrite(padapter, buffer, size);
+ return rtl8723au_writeN(padapter, FW_8723A_START_ADDRESS, size, buffer);
}
static int _WriteFW(struct rtw_adapter *padapter, void *buffer, u32 size)
@@ -743,84 +733,6 @@ u16 rtl8723a_EfuseGetCurrentSize_BT(struct rtw_adapter *padapter)
return retU2;
}
-bool
-rtl8723a_EfusePgPacketRead(struct rtw_adapter *padapter, u8 offset, u8 *data)
-{
- u8 efuse_data, word_cnts = 0;
- u16 efuse_addr = 0;
- u8 hoffset = 0, hworden = 0;
- u8 i;
- u8 max_section = 0;
- s32 ret;
-
- if (data == NULL)
- return false;
-
- EFUSE_GetEfuseDefinition23a(padapter, EFUSE_WIFI, TYPE_EFUSE_MAX_SECTION,
- &max_section);
- if (offset > max_section) {
- DBG_8723A("%s: Packet offset(%d) is illegal(>%d)!\n",
- __func__, offset, max_section);
- return false;
- }
-
- memset(data, 0xFF, PGPKT_DATA_SIZE);
- ret = true;
-
- /* */
- /* <Roger_TODO> Efuse has been pre-programmed dummy 5Bytes at the
- end of Efuse by CP. */
- /* Skip dummy parts to prevent unexpected data read from Efuse. */
- /* By pass right now. 2009.02.19. */
- /* */
- while (AVAILABLE_EFUSE_ADDR(efuse_addr)) {
- if (efuse_OneByteRead23a(padapter, efuse_addr++, &efuse_data) ==
- _FAIL) {
- ret = false;
- break;
- }
-
- if (efuse_data == 0xFF)
- break;
-
- if (EXT_HEADER(efuse_data)) {
- hoffset = GET_HDR_OFFSET_2_0(efuse_data);
- efuse_OneByteRead23a(padapter, efuse_addr++, &efuse_data);
- if (ALL_WORDS_DISABLED(efuse_data)) {
- DBG_8723A("%s: Error!! All words disabled!\n",
- __func__);
- continue;
- }
-
- hoffset |= ((efuse_data & 0xF0) >> 1);
- hworden = efuse_data & 0x0F;
- } else {
- hoffset = (efuse_data >> 4) & 0x0F;
- hworden = efuse_data & 0x0F;
- }
-
- if (hoffset == offset) {
- for (i = 0; i < EFUSE_MAX_WORD_UNIT; i++) {
- /* Check word enable condition in the section */
- if (!(hworden & (0x01 << i))) {
- ReadEFuseByte23a(padapter, efuse_addr++,
- &efuse_data);
- data[i * 2] = efuse_data;
-
- ReadEFuseByte23a(padapter, efuse_addr++,
- &efuse_data);
- data[(i * 2) + 1] = efuse_data;
- }
- }
- } else {
- word_cnts = Efuse_CalculateWordCnts23a(hworden);
- efuse_addr += word_cnts * 2;
- }
- }
-
- return ret;
-}
-
void rtl8723a_read_chip_version(struct rtw_adapter *padapter)
{
u32 value32;
@@ -1126,6 +1038,21 @@ exit:
return ret;
}
+void handle_txrpt_ccx_8723a(struct rtw_adapter *adapter, void *buf)
+{
+ struct txrpt_ccx_8723a *txrpt_ccx = buf;
+ struct submit_ctx *pack_tx_ops = &adapter->xmitpriv.ack_tx_ops;
+
+ if (txrpt_ccx->int_ccx && adapter->xmitpriv.ack_tx) {
+ if (txrpt_ccx->pkt_ok)
+ rtw23a_sctx_done_err(&pack_tx_ops,
+ RTW_SCTX_DONE_SUCCESS);
+ else
+ rtw23a_sctx_done_err(&pack_tx_ops,
+ RTW_SCTX_DONE_CCX_PKT_FAIL);
+ }
+}
+
void rtl8723a_InitAntenna_Selection(struct rtw_adapter *padapter)
{
u8 val;
@@ -1326,18 +1253,17 @@ c. APSD_CTRL 0x600[7:0] = 0x40
d. SYS_FUNC_EN 0x02[7:0] = 0x16 reset BB state machine
e. SYS_FUNC_EN 0x02[7:0] = 0x14 reset BB state machine
***************************************/
- u8 eRFPath = 0, value8 = 0;
+ u8 value8;
rtl8723au_write8(padapter, REG_TXPAUSE, 0xFF);
- PHY_SetRFReg(padapter, (enum RF_RADIO_PATH) eRFPath, 0x0, bMaskByte0, 0x0);
+ PHY_SetRFReg(padapter, RF_PATH_A, 0x0, bMaskByte0, 0x0);
- value8 |= APSDOFF;
+ value8 = APSDOFF;
rtl8723au_write8(padapter, REG_APSD_CTRL, value8); /* 0x40 */
/* Set BB reset at first */
- value8 = 0;
- value8 |= (FEN_USBD | FEN_USBA | FEN_BB_GLB_RSTn);
+ value8 = FEN_USBD | FEN_USBA | FEN_BB_GLB_RSTn;
rtl8723au_write8(padapter, REG_SYS_FUNC_EN, value8); /* 0x16 */
/* Set global reset. */
@@ -1350,11 +1276,6 @@ e. SYS_FUNC_EN 0x02[7:0] = 0x14 reset BB state machine
/* RT_TRACE(COMP_INIT, DBG_LOUD, ("======> RF off and reset BB.\n")); */
}
-static void _DisableRFAFEAndResetBB(struct rtw_adapter *padapter)
-{
- _DisableRFAFEAndResetBB8192C(padapter);
-}
-
static void _ResetDigitalProcedure1_92C(struct rtw_adapter *padapter,
bool bWithoutHWSM)
{
@@ -1368,18 +1289,18 @@ static void _ResetDigitalProcedure1_92C(struct rtw_adapter *padapter,
i. SYS_FUNC_EN 0x02[10]= 1 enable MCU register,
(8051 enable)
******************************/
- u16 valu16 = 0;
+ u16 valu16;
rtl8723au_write8(padapter, REG_MCUFWDL, 0);
valu16 = rtl8723au_read16(padapter, REG_SYS_FUNC_EN);
/* reset MCU , 8051 */
rtl8723au_write16(padapter, REG_SYS_FUNC_EN,
- valu16 & (~FEN_CPUEN));
+ valu16 & ~FEN_CPUEN);
valu16 = rtl8723au_read16(padapter, REG_SYS_FUNC_EN) & 0x0FFF;
/* reset MAC */
rtl8723au_write16(padapter, REG_SYS_FUNC_EN,
- valu16 | (FEN_HWPDN | FEN_ELDR));
+ valu16 | FEN_HWPDN | FEN_ELDR);
valu16 = rtl8723au_read16(padapter, REG_SYS_FUNC_EN);
/* enable MCU , 8051 */
@@ -1387,43 +1308,41 @@ static void _ResetDigitalProcedure1_92C(struct rtw_adapter *padapter,
valu16 | FEN_CPUEN);
} else {
u8 retry_cnts = 0;
+ u8 val8;
+
+ val8 = rtl8723au_read8(padapter, REG_MCUFWDL);
/* 2010/08/12 MH For USB SS, we can not stop 8051 when we
are trying to enter IPS/HW&SW radio off. For
S3/S4/S5/Disable, we can stop 8051 because */
/* we will init FW when power on again. */
/* If we want to SS mode, we can not reset 8051. */
- if (rtl8723au_read8(padapter, REG_MCUFWDL) & BIT(1)) {
+ if ((val8 & BIT(1)) && padapter->bFWReady) {
/* IF fw in RAM code, do reset */
- if (padapter->bFWReady) {
- /* 2010/08/25 MH Accordign to RD alfred's
- suggestion, we need to disable other */
- /* HRCV INT to influence 8051 reset. */
- rtl8723au_write8(padapter, REG_FWIMR, 0x20);
- /* 2011/02/15 MH According to Alex's
- suggestion, close mask to prevent
- incorrect FW write operation. */
- rtl8723au_write8(padapter, REG_FTIMR, 0x00);
- rtl8723au_write8(padapter, REG_FSIMR, 0x00);
-
- /* 8051 reset by self */
- rtl8723au_write8(padapter, REG_HMETFR + 3,
- 0x20);
-
- while ((retry_cnts++ < 100) &&
- (FEN_CPUEN &
- rtl8723au_read16(padapter,
- REG_SYS_FUNC_EN))) {
- udelay(50); /* us */
- }
+ /* 2010/08/25 MH Accordign to RD alfred's
+ suggestion, we need to disable other */
+ /* HRCV INT to influence 8051 reset. */
+ rtl8723au_write8(padapter, REG_FWIMR, 0x20);
+ /* 2011/02/15 MH According to Alex's
+ suggestion, close mask to prevent
+ incorrect FW write operation. */
+ rtl8723au_write8(padapter, REG_FTIMR, 0x00);
+ rtl8723au_write8(padapter, REG_FSIMR, 0x00);
+
+ /* 8051 reset by self */
+ rtl8723au_write8(padapter, REG_HMETFR + 3, 0x20);
+
+ while ((retry_cnts++ < 100) &&
+ (rtl8723au_read16(padapter, REG_SYS_FUNC_EN) &
+ FEN_CPUEN)) {
+ udelay(50); /* us */
+ }
- if (retry_cnts >= 100) {
- /* Reset MAC and Enable 8051 */
- rtl8723au_write8(padapter,
- REG_SYS_FUNC_EN + 1,
- 0x50);
- mdelay(10);
- }
+ if (retry_cnts >= 100) {
+ /* Reset MAC and Enable 8051 */
+ rtl8723au_write8(padapter,
+ REG_SYS_FUNC_EN + 1, 0x50);
+ mdelay(10);
}
}
/* Reset MAC and Enable 8051 */
@@ -1450,12 +1369,6 @@ static void _ResetDigitalProcedure1_92C(struct rtw_adapter *padapter,
}
}
-static void _ResetDigitalProcedure1(struct rtw_adapter *padapter,
- bool bWithoutHWSM)
-{
- _ResetDigitalProcedure1_92C(padapter, bWithoutHWSM);
-}
-
static void _ResetDigitalProcedure2(struct rtw_adapter *padapter)
{
/*****************************
@@ -1472,8 +1385,8 @@ m. SYS_ISO_CTRL 0x01[7:0] = 0x83 isolated ELDR to PON
static void _DisableAnalog(struct rtw_adapter *padapter, bool bWithoutHWSM)
{
struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter);
- u16 value16 = 0;
- u8 value8 = 0;
+ u16 value16;
+ u8 value8;
if (bWithoutHWSM) {
/*****************************
@@ -1487,7 +1400,7 @@ static void _DisableAnalog(struct rtw_adapter *padapter, bool bWithoutHWSM)
/* rtl8723au_write8(padapter, REG_LDOV12D_CTRL, 0x54); */
value8 = rtl8723au_read8(padapter, REG_LDOV12D_CTRL);
- value8 &= (~LDV12_EN);
+ value8 &= ~LDV12_EN;
rtl8723au_write8(padapter, REG_LDOV12D_CTRL, value8);
/* RT_TRACE(COMP_INIT, DBG_LOUD,
(" REG_LDOV12D_CTRL Reg0x21:0x%02x.\n", value8)); */
@@ -1509,9 +1422,9 @@ static void _DisableAnalog(struct rtw_adapter *padapter, bool bWithoutHWSM)
use HW to shut down 8051 automatically. */
/* Becasue suspend operatione need the asistance of 8051
to wait for 3ms. */
- value16 |= (APDM_HOST | AFSM_HSUS | PFM_ALDN);
+ value16 = APDM_HOST | AFSM_HSUS | PFM_ALDN;
} else {
- value16 |= (APDM_HOST | AFSM_HSUS | PFM_ALDN);
+ value16 = APDM_HOST | AFSM_HSUS | PFM_ALDN;
}
rtl8723au_write16(padapter, REG_APS_FSMCO, value16); /* 0x4802 */
@@ -1522,16 +1435,14 @@ static void _DisableAnalog(struct rtw_adapter *padapter, bool bWithoutHWSM)
/* HW Auto state machine */
int CardDisableHWSM(struct rtw_adapter *padapter, u8 resetMCU)
{
- int rtStatus = _SUCCESS;
-
if (padapter->bSurpriseRemoved) {
- return rtStatus;
+ return _SUCCESS;
}
/* RF Off Sequence ==== */
- _DisableRFAFEAndResetBB(padapter);
+ _DisableRFAFEAndResetBB8192C(padapter);
/* ==== Reset digital sequence ====== */
- _ResetDigitalProcedure1(padapter, false);
+ _ResetDigitalProcedure1_92C(padapter, false);
/* ==== Pull GPIO PIN to balance level and LED control ====== */
_DisableGPIO(padapter);
@@ -1542,25 +1453,21 @@ int CardDisableHWSM(struct rtw_adapter *padapter, u8 resetMCU)
RT_TRACE(_module_hci_hal_init_c_, _drv_info_,
("======> Card disable finished.\n"));
- return rtStatus;
+ return _SUCCESS;
}
/* without HW Auto state machine */
int CardDisableWithoutHWSM(struct rtw_adapter *padapter)
{
- int rtStatus = _SUCCESS;
-
- /* RT_TRACE(COMP_INIT, DBG_LOUD,
- ("======> Card Disable Without HWSM .\n")); */
if (padapter->bSurpriseRemoved) {
- return rtStatus;
+ return _SUCCESS;
}
/* RF Off Sequence ==== */
- _DisableRFAFEAndResetBB(padapter);
+ _DisableRFAFEAndResetBB8192C(padapter);
/* ==== Reset digital sequence ====== */
- _ResetDigitalProcedure1(padapter, true);
+ _ResetDigitalProcedure1_92C(padapter, true);
/* ==== Pull GPIO PIN to balance level and LED control ====== */
_DisableGPIO(padapter);
@@ -1573,29 +1480,27 @@ int CardDisableWithoutHWSM(struct rtw_adapter *padapter)
/* RT_TRACE(COMP_INIT, DBG_LOUD,
("<====== Card Disable Without HWSM .\n")); */
- return rtStatus;
+ return _SUCCESS;
}
void Hal_InitPGData(struct rtw_adapter *padapter, u8 *PROMContent)
{
struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
- if (false == pEEPROM->bautoload_fail_flag) { /* autoload OK. */
+ if (!pEEPROM->bautoload_fail_flag) { /* autoload OK. */
if (!pEEPROM->EepromOrEfuse) {
/* Read EFUSE real map to shadow. */
EFUSE_ShadowMapUpdate23a(padapter, EFUSE_WIFI);
- memcpy((void *)PROMContent,
- (void *)pEEPROM->efuse_eeprom_data,
+ memcpy(PROMContent, pEEPROM->efuse_eeprom_data,
HWSET_MAX_SIZE);
}
- } else { /* autoload fail */
+ } else {
RT_TRACE(_module_hci_hal_init_c_, _drv_notice_,
("AutoLoad Fail reported from CR9346!!\n"));
-/* pHalData->AutoloadFailFlag = true; */
/* update to default value 0xFF */
- if (false == pEEPROM->EepromOrEfuse)
+ if (!pEEPROM->EepromOrEfuse)
EFUSE_ShadowMapUpdate23a(padapter, EFUSE_WIFI);
- memcpy((void *)PROMContent, (void *)pEEPROM->efuse_eeprom_data,
+ memcpy(PROMContent, pEEPROM->efuse_eeprom_data,
HWSET_MAX_SIZE);
}
}
@@ -1945,13 +1850,13 @@ Hal_EfuseParseThermalMeter_8723A(struct rtw_adapter *padapter,
/* */
/* ThermalMeter from EEPROM */
/* */
- if (AutoloadFail == false)
+ if (!AutoloadFail)
pHalData->EEPROMThermalMeter =
PROMContent[EEPROM_THERMAL_METER_8723A];
else
pHalData->EEPROMThermalMeter = EEPROM_Default_ThermalMeter;
- if ((pHalData->EEPROMThermalMeter == 0xff) || (AutoloadFail == true)) {
+ if ((pHalData->EEPROMThermalMeter == 0xff) || AutoloadFail) {
pHalData->bAPKThermalMeterIgnore = true;
pHalData->EEPROMThermalMeter = EEPROM_Default_ThermalMeter;
}
@@ -1960,10 +1865,6 @@ Hal_EfuseParseThermalMeter_8723A(struct rtw_adapter *padapter,
pHalData->EEPROMThermalMeter);
}
-void Hal_InitChannelPlan23a(struct rtw_adapter *padapter)
-{
-}
-
static void rtl8723a_cal_txdesc_chksum(struct tx_desc *ptxdesc)
{
u16 *usPtr = (u16 *) ptxdesc;
@@ -1981,254 +1882,6 @@ static void rtl8723a_cal_txdesc_chksum(struct tx_desc *ptxdesc)
ptxdesc->txdw7 |= cpu_to_le32(checksum & 0x0000ffff);
}
-static void fill_txdesc_sectype(struct pkt_attrib *pattrib,
- struct txdesc_8723a *ptxdesc)
-{
- if ((pattrib->encrypt > 0) && !pattrib->bswenc) {
- switch (pattrib->encrypt) {
- /* SEC_TYPE */
- case WLAN_CIPHER_SUITE_WEP40:
- case WLAN_CIPHER_SUITE_WEP104:
- case WLAN_CIPHER_SUITE_TKIP:
- ptxdesc->sectype = 1;
- break;
-
- case WLAN_CIPHER_SUITE_CCMP:
- ptxdesc->sectype = 3;
- break;
-
- case 0:
- default:
- break;
- }
- }
-}
-
-static void fill_txdesc_vcs(struct pkt_attrib *pattrib,
- struct txdesc_8723a *ptxdesc)
-{
- /* DBG_8723A("cvs_mode =%d\n", pattrib->vcs_mode); */
-
- switch (pattrib->vcs_mode) {
- case RTS_CTS:
- ptxdesc->rtsen = 1;
- break;
-
- case CTS_TO_SELF:
- ptxdesc->cts2self = 1;
- break;
-
- case NONE_VCS:
- default:
- break;
- }
-
- if (pattrib->vcs_mode) {
- ptxdesc->hw_rts_en = 1; /* ENABLE HW RTS */
-
- /* Set RTS BW */
- if (pattrib->ht_en) {
- if (pattrib->bwmode & HT_CHANNEL_WIDTH_40)
- ptxdesc->rts_bw = 1;
-
- switch (pattrib->ch_offset) {
- case HAL_PRIME_CHNL_OFFSET_DONT_CARE:
- ptxdesc->rts_sc = 0;
- break;
-
- case HAL_PRIME_CHNL_OFFSET_LOWER:
- ptxdesc->rts_sc = 1;
- break;
-
- case HAL_PRIME_CHNL_OFFSET_UPPER:
- ptxdesc->rts_sc = 2;
- break;
-
- default:
- ptxdesc->rts_sc = 3; /* Duplicate */
- break;
- }
- }
- }
-}
-
-static void fill_txdesc_phy(struct pkt_attrib *pattrib,
- struct txdesc_8723a *ptxdesc)
-{
- if (pattrib->ht_en) {
- if (pattrib->bwmode & HT_CHANNEL_WIDTH_40)
- ptxdesc->data_bw = 1;
-
- switch (pattrib->ch_offset) {
- case HAL_PRIME_CHNL_OFFSET_DONT_CARE:
- ptxdesc->data_sc = 0;
- break;
-
- case HAL_PRIME_CHNL_OFFSET_LOWER:
- ptxdesc->data_sc = 1;
- break;
-
- case HAL_PRIME_CHNL_OFFSET_UPPER:
- ptxdesc->data_sc = 2;
- break;
-
- default:
- ptxdesc->data_sc = 3; /* Duplicate */
- break;
- }
- }
-}
-
-static void rtl8723a_fill_default_txdesc(struct xmit_frame *pxmitframe,
- u8 *pbuf)
-{
- struct rtw_adapter *padapter;
- struct hal_data_8723a *pHalData;
- struct dm_priv *pdmpriv;
- struct mlme_ext_priv *pmlmeext;
- struct mlme_ext_info *pmlmeinfo;
- struct pkt_attrib *pattrib;
- struct txdesc_8723a *ptxdesc;
- s32 bmcst;
-
- padapter = pxmitframe->padapter;
- pHalData = GET_HAL_DATA(padapter);
- pdmpriv = &pHalData->dmpriv;
- pmlmeext = &padapter->mlmeextpriv;
- pmlmeinfo = &pmlmeext->mlmext_info;
-
- pattrib = &pxmitframe->attrib;
- bmcst = is_multicast_ether_addr(pattrib->ra);
-
- ptxdesc = (struct txdesc_8723a *)pbuf;
-
- if (pxmitframe->frame_tag == DATA_FRAMETAG) {
- ptxdesc->macid = pattrib->mac_id; /* CAM_ID(MAC_ID) */
-
- if (pattrib->ampdu_en == true)
- ptxdesc->agg_en = 1; /* AGG EN */
- else
- ptxdesc->bk = 1; /* AGG BK */
-
- ptxdesc->qsel = pattrib->qsel;
- ptxdesc->rate_id = pattrib->raid;
-
- fill_txdesc_sectype(pattrib, ptxdesc);
-
- ptxdesc->seq = pattrib->seqnum;
-
- if ((pattrib->ether_type != 0x888e) &&
- (pattrib->ether_type != 0x0806) &&
- (pattrib->dhcp_pkt != 1)) {
- /* Non EAP & ARP & DHCP type data packet */
-
- fill_txdesc_vcs(pattrib, ptxdesc);
- fill_txdesc_phy(pattrib, ptxdesc);
-
- ptxdesc->rtsrate = 8; /* RTS Rate = 24M */
- ptxdesc->data_ratefb_lmt = 0x1F;
- ptxdesc->rts_ratefb_lmt = 0xF;
-
- /* use REG_INIDATA_RATE_SEL value */
- ptxdesc->datarate =
- pdmpriv->INIDATA_RATE[pattrib->mac_id];
-
- } else {
- /* EAP data packet and ARP packet. */
- /* Use the 1M data rate to send the EAP/ARP packet. */
- /* This will maybe make the handshake smooth. */
-
- ptxdesc->bk = 1; /* AGG BK */
- ptxdesc->userate = 1; /* driver uses rate */
- if (pmlmeinfo->preamble_mode == PREAMBLE_SHORT)
- ptxdesc->data_short = 1;
- ptxdesc->datarate = MRateToHwRate23a(pmlmeext->tx_rate);
- }
- } else if (pxmitframe->frame_tag == MGNT_FRAMETAG) {
-/* RT_TRACE(_module_hal_xmit_c_, _drv_notice_,
- ("%s: MGNT_FRAMETAG\n", __func__)); */
-
- ptxdesc->macid = pattrib->mac_id; /* CAM_ID(MAC_ID) */
- ptxdesc->qsel = pattrib->qsel;
- ptxdesc->rate_id = pattrib->raid; /* Rate ID */
- ptxdesc->seq = pattrib->seqnum;
- ptxdesc->userate = 1; /* driver uses rate, 1M */
- ptxdesc->rty_lmt_en = 1; /* retry limit enable */
- ptxdesc->data_rt_lmt = 6; /* retry limit = 6 */
-
- /* CCX-TXRPT ack for xmit mgmt frames. */
- if (pxmitframe->ack_report)
- ptxdesc->ccx = 1;
-
- ptxdesc->datarate = MRateToHwRate23a(pmlmeext->tx_rate);
- } else if (pxmitframe->frame_tag == TXAGG_FRAMETAG) {
- RT_TRACE(_module_hal_xmit_c_, _drv_warning_,
- ("%s: TXAGG_FRAMETAG\n", __func__));
- } else {
- RT_TRACE(_module_hal_xmit_c_, _drv_warning_,
- ("%s: frame_tag = 0x%x\n", __func__,
- pxmitframe->frame_tag));
-
- ptxdesc->macid = 4; /* CAM_ID(MAC_ID) */
- ptxdesc->rate_id = 6; /* Rate ID */
- ptxdesc->seq = pattrib->seqnum;
- ptxdesc->userate = 1; /* driver uses rate */
- ptxdesc->datarate = MRateToHwRate23a(pmlmeext->tx_rate);
- }
-
- ptxdesc->pktlen = pattrib->last_txcmdsz;
- ptxdesc->offset = TXDESC_SIZE + OFFSET_SZ;
- if (bmcst)
- ptxdesc->bmc = 1;
- ptxdesc->ls = 1;
- ptxdesc->fs = 1;
- ptxdesc->own = 1;
-
- /* 2009.11.05. tynli_test. Suggested by SD4 Filen for FW LPS. */
- /* (1) The sequence number of each non-Qos frame / broadcast /
- * multicast / mgnt frame should be controled by Hw because Fw
- * will also send null data which we cannot control when Fw LPS enable.
- * --> default enable non-Qos data sequense number.
- 2010.06.23. by tynli. */
- /* (2) Enable HW SEQ control for beacon packet,
- * because we use Hw beacon. */
- /* (3) Use HW Qos SEQ to control the seq num of Ext port
- * non-Qos packets. */
- /* 2010.06.23. Added by tynli. */
- if (!pattrib->qos_en) {
- /* Hw set sequence number */
- ptxdesc->hwseq_en = 1; /* HWSEQ_EN */
- ptxdesc->hwseq_sel = 0; /* HWSEQ_SEL */
- }
-}
-
-/*
- * Description:
- *
- * Parameters:
- * pxmitframe xmitframe
- * pbuf where to fill tx desc
- */
-void rtl8723a_update_txdesc(struct xmit_frame *pxmitframe, u8 *pbuf)
-{
- struct tx_desc *pdesc;
-
- pdesc = (struct tx_desc *)pbuf;
- memset(pdesc, 0, sizeof(struct tx_desc));
-
- rtl8723a_fill_default_txdesc(pxmitframe, pbuf);
-
- pdesc->txdw0 = cpu_to_le32(pdesc->txdw0);
- pdesc->txdw1 = cpu_to_le32(pdesc->txdw1);
- pdesc->txdw2 = cpu_to_le32(pdesc->txdw2);
- pdesc->txdw3 = cpu_to_le32(pdesc->txdw3);
- pdesc->txdw4 = cpu_to_le32(pdesc->txdw4);
- pdesc->txdw5 = cpu_to_le32(pdesc->txdw5);
- pdesc->txdw6 = cpu_to_le32(pdesc->txdw6);
- pdesc->txdw7 = cpu_to_le32(pdesc->txdw7);
- rtl8723a_cal_txdesc_chksum(pdesc);
-}
-
/*
* Description: In normal chip, we should send some packet to Hw which
* will be used by Fw in FW LPS mode. The function is to fill the Tx