Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 247204
b: refs/heads/master
c: 3ac5e26
h: refs/heads/master
v: v3
  • Loading branch information
Chaoming_Li authored and John W. Linville committed Apr 26, 2011
1 parent 4973246 commit b24a964
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 34 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: beb5bc4020436ee50bd50e82c5a64eb087f0e3b3
refs/heads/master: 3ac5e26a1e935469a8bdae1d624bc3b59d1fcdc5
81 changes: 50 additions & 31 deletions trunk/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,29 +223,15 @@ int rtl92c_download_fw(struct ieee80211_hw *hw)
u8 *pfwdata;
u32 fwsize;
enum version_8192c version = rtlhal->version;
const struct firmware *firmware;

printk(KERN_INFO "rtl8192c: Loading firmware file %s\n",
rtlpriv->cfg->fw_name);
if (request_firmware(&firmware, rtlpriv->cfg->fw_name,
rtlpriv->io.dev)) {
printk(KERN_ERR "rtl8192c: Firmware loading failed\n");
if (!rtlhal->pfirmware)
return 1;
}

if (firmware->size > 0x4000) {
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
("Firmware is too big!\n"));
release_firmware(firmware);
return 1;
}

memcpy(rtlhal->pfirmware, firmware->data, firmware->size);
fwsize = firmware->size;
release_firmware(firmware);

pfwheader = (struct rtl92c_firmware_header *)rtlhal->pfirmware;
pfwdata = (u8 *) rtlhal->pfirmware;
fwsize = rtlhal->fwsize;

if (IS_FW_HEADER_EXIST(pfwheader)) {
RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG,
Expand Down Expand Up @@ -553,6 +539,39 @@ void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode)
}
EXPORT_SYMBOL(rtl92c_set_fw_pwrmode_cmd);

static bool _rtl92c_cmd_send_packet(struct ieee80211_hw *hw,
struct sk_buff *skb)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
struct rtl8192_tx_ring *ring;
struct rtl_tx_desc *pdesc;
u8 own;
unsigned long flags;
struct sk_buff *pskb = NULL;

ring = &rtlpci->tx_ring[BEACON_QUEUE];

pskb = __skb_dequeue(&ring->queue);
if (pskb)
kfree_skb(pskb);

spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags);

pdesc = &ring->desc[0];
own = (u8) rtlpriv->cfg->ops->get_desc((u8 *) pdesc, true, HW_DESC_OWN);

rtlpriv->cfg->ops->fill_tx_cmddesc(hw, (u8 *) pdesc, 1, 1, skb);

__skb_queue_tail(&ring->queue, skb);

spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags);

rtlpriv->cfg->ops->tx_polling(hw, BEACON_QUEUE);

return true;
}

#define BEACON_PG 0 /*->1*/
#define PSPOLL_PG 2
#define NULL_PG 3
Expand Down Expand Up @@ -670,7 +689,7 @@ static u8 reserved_page_packet[TOTAL_RESERVED_PKT_LEN] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};

void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)
void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
Expand All @@ -679,12 +698,12 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)
u32 totalpacketlen;
bool rtstatus;
u8 u1RsvdPageLoc[3] = {0};
bool b_dlok = false;
bool dlok = false;

u8 *beacon;
u8 *p_pspoll;
u8 *pspoll;
u8 *nullfunc;
u8 *p_probersp;
u8 *probersp;
/*---------------------------------------------------------
(1) beacon
---------------------------------------------------------*/
Expand All @@ -695,10 +714,10 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)
/*-------------------------------------------------------
(2) ps-poll
--------------------------------------------------------*/
p_pspoll = &reserved_page_packet[PSPOLL_PG * 128];
SET_80211_PS_POLL_AID(p_pspoll, (mac->assoc_id | 0xc000));
SET_80211_PS_POLL_BSSID(p_pspoll, mac->bssid);
SET_80211_PS_POLL_TA(p_pspoll, mac->mac_addr);
pspoll = &reserved_page_packet[PSPOLL_PG * 128];
SET_80211_PS_POLL_AID(pspoll, (mac->assoc_id | 0xc000));
SET_80211_PS_POLL_BSSID(pspoll, mac->bssid);
SET_80211_PS_POLL_TA(pspoll, mac->mac_addr);

SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1RsvdPageLoc, PSPOLL_PG);

Expand All @@ -715,10 +734,10 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)
/*---------------------------------------------------------
(4) probe response
----------------------------------------------------------*/
p_probersp = &reserved_page_packet[PROBERSP_PG * 128];
SET_80211_HDR_ADDRESS1(p_probersp, mac->bssid);
SET_80211_HDR_ADDRESS2(p_probersp, mac->mac_addr);
SET_80211_HDR_ADDRESS3(p_probersp, mac->bssid);
probersp = &reserved_page_packet[PROBERSP_PG * 128];
SET_80211_HDR_ADDRESS1(probersp, mac->bssid);
SET_80211_HDR_ADDRESS2(probersp, mac->mac_addr);
SET_80211_HDR_ADDRESS3(probersp, mac->bssid);

SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(u1RsvdPageLoc, PROBERSP_PG);

Expand All @@ -736,12 +755,12 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)
memcpy((u8 *) skb_put(skb, totalpacketlen),
&reserved_page_packet, totalpacketlen);

rtstatus = rtlpriv->cfg->ops->cmd_send_packet(hw, skb);
rtstatus = _rtl92c_cmd_send_packet(hw, skb);

if (rtstatus)
b_dlok = true;
dlok = true;

if (b_dlok) {
if (dlok) {
RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
("Set RSVD page location to Fw.\n"));
RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
*
*****************************************************************************/

#ifndef __RTL92C__FW__H__
#define __RTL92C__FW__H__
#ifndef __RTL92C__FW__COMMON__H__
#define __RTL92C__FW__COMMON__H__

#define FW_8192C_SIZE 0x3000
#define FW_8192C_START_ADDRESS 0x1000
Expand Down

0 comments on commit b24a964

Please sign in to comment.