rtl8xxxu: Implement generic init_queue_reserved_page() function

Longer term we should switch all the chips over to use this function
instead of the random chip specific ifdef hacks.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
Jes Sorensen 2016-04-14 14:58:44 -04:00 committed by Kalle Valo
parent 59b24dad20
commit 89c2a097df
3 changed files with 71 additions and 15 deletions

View File

@ -7439,6 +7439,60 @@ static void rtl8723bu_init_statistics(struct rtl8xxxu_priv *priv)
rtl8xxxu_write32(priv, REG_OFDM0_FA_RSTC, val32); rtl8xxxu_write32(priv, REG_OFDM0_FA_RSTC, val32);
} }
static void rtl8xxxu_old_init_queue_reserved_page(struct rtl8xxxu_priv *priv)
{
u8 val8;
u32 val32;
if (priv->ep_tx_normal_queue)
val8 = TX_PAGE_NUM_NORM_PQ;
else
val8 = 0;
rtl8xxxu_write8(priv, REG_RQPN_NPQ, val8);
val32 = (TX_PAGE_NUM_PUBQ << RQPN_PUB_PQ_SHIFT) | RQPN_LOAD;
if (priv->ep_tx_high_queue)
val32 |= (TX_PAGE_NUM_HI_PQ << RQPN_HI_PQ_SHIFT);
if (priv->ep_tx_low_queue)
val32 |= (TX_PAGE_NUM_LO_PQ << RQPN_LO_PQ_SHIFT);
rtl8xxxu_write32(priv, REG_RQPN, val32);
}
static void rtl8xxxu_init_queue_reserved_page(struct rtl8xxxu_priv *priv)
{
struct rtl8xxxu_fileops *fops = priv->fops;
u32 hq, lq, nq, eq, pubq;
u32 val32;
hq = 0;
lq = 0;
nq = 0;
eq = 0;
pubq = 0;
if (priv->ep_tx_high_queue)
hq = fops->page_num_hi;
if (priv->ep_tx_low_queue)
lq = fops->page_num_lo;
if (priv->ep_tx_normal_queue)
nq = fops->page_num_norm;
val32 = (nq << RQPN_NPQ_SHIFT) | (eq << RQPN_EPQ_SHIFT);
rtl8xxxu_write32(priv, REG_RQPN_NPQ, val32);
pubq = fops->total_page_num - hq - lq - nq;
val32 = RQPN_LOAD;
val32 |= (hq << RQPN_HI_PQ_SHIFT);
val32 |= (lq << RQPN_LO_PQ_SHIFT);
val32 |= (pubq << RQPN_PUB_PQ_SHIFT);
rtl8xxxu_write32(priv, REG_RQPN, val32);
}
static int rtl8xxxu_init_device(struct ieee80211_hw *hw) static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
{ {
struct rtl8xxxu_priv *priv = hw->priv; struct rtl8xxxu_priv *priv = hw->priv;
@ -7469,21 +7523,10 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
} }
if (!macpower) { if (!macpower) {
if (priv->ep_tx_normal_queue) if (priv->fops->total_page_num)
val8 = TX_PAGE_NUM_NORM_PQ; rtl8xxxu_init_queue_reserved_page(priv);
else else
val8 = 0; rtl8xxxu_old_init_queue_reserved_page(priv);
rtl8xxxu_write8(priv, REG_RQPN_NPQ, val8);
val32 = (TX_PAGE_NUM_PUBQ << RQPN_NORM_PQ_SHIFT) | RQPN_LOAD;
if (priv->ep_tx_high_queue)
val32 |= (TX_PAGE_NUM_HI_PQ << RQPN_HI_PQ_SHIFT);
if (priv->ep_tx_low_queue)
val32 |= (TX_PAGE_NUM_LO_PQ << RQPN_LO_PQ_SHIFT);
rtl8xxxu_write32(priv, REG_RQPN, val32);
} }
ret = rtl8xxxu_init_queue_priority(priv); ret = rtl8xxxu_init_queue_priority(priv);
@ -9751,6 +9794,10 @@ static struct rtl8xxxu_fileops rtl8192eu_fops = {
.adda_2t_path_on_a = 0x0fc01616, .adda_2t_path_on_a = 0x0fc01616,
.adda_2t_path_on_b = 0x0fc01616, .adda_2t_path_on_b = 0x0fc01616,
.mactable = rtl8192e_mac_init_table, .mactable = rtl8192e_mac_init_table,
.total_page_num = TX_TOTAL_PAGE_NUM_8192E,
.page_num_hi = TX_PAGE_NUM_HI_PQ_8192E,
.page_num_lo = TX_PAGE_NUM_LO_PQ_8192E,
.page_num_norm = TX_PAGE_NUM_NORM_PQ_8192E,
}; };
static struct usb_device_id dev_table[] = { static struct usb_device_id dev_table[] = {

View File

@ -49,6 +49,11 @@
#define TX_PAGE_NUM_LO_PQ 0x02 #define TX_PAGE_NUM_LO_PQ 0x02
#define TX_PAGE_NUM_NORM_PQ 0x02 #define TX_PAGE_NUM_NORM_PQ 0x02
#define TX_PAGE_NUM_PUBQ_8192E 0xe7
#define TX_PAGE_NUM_HI_PQ_8192E 0x08
#define TX_PAGE_NUM_LO_PQ_8192E 0x0c
#define TX_PAGE_NUM_NORM_PQ_8192E 0x00
#define RTL_FW_PAGE_SIZE 4096 #define RTL_FW_PAGE_SIZE 4096
#define RTL8XXXU_FIRMWARE_POLL_MAX 1000 #define RTL8XXXU_FIRMWARE_POLL_MAX 1000
@ -1304,4 +1309,8 @@ struct rtl8xxxu_fileops {
u32 adda_2t_path_on_a; u32 adda_2t_path_on_a;
u32 adda_2t_path_on_b; u32 adda_2t_path_on_b;
struct rtl8xxxu_reg8val *mactable; struct rtl8xxxu_reg8val *mactable;
u8 total_page_num;
u8 page_num_hi;
u8 page_num_lo;
u8 page_num_norm;
}; };

View File

@ -387,7 +387,7 @@
#define REG_RQPN 0x0200 #define REG_RQPN 0x0200
#define RQPN_HI_PQ_SHIFT 0 #define RQPN_HI_PQ_SHIFT 0
#define RQPN_LO_PQ_SHIFT 8 #define RQPN_LO_PQ_SHIFT 8
#define RQPN_NORM_PQ_SHIFT 16 #define RQPN_PUB_PQ_SHIFT 16
#define RQPN_LOAD BIT(31) #define RQPN_LOAD BIT(31)
#define REG_FIFOPAGE 0x0204 #define REG_FIFOPAGE 0x0204