drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c- Extension
.c- Size
- 22867 bytes
- Lines
- 771
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
../wifi.h../pci.h../base.h../core.h../efuse.h../rtl8192ce/reg.h../rtl8192ce/def.hfw_common.hlinux/export.h
Detected Declarations
function _rtl92c_enable_fw_downloadfunction _rtl92c_write_fwfunction _rtl92c_fw_free_to_gofunction rtl92c_download_fwfunction _rtl92c_check_fw_read_last_h2cfunction _rtl92c_fill_h2c_commandfunction rtl92c_fill_h2c_cmdfunction rtl92c_firmware_selfresetfunction rtl92c_set_fw_pwrmode_cmdfunction rtl92c_set_fw_rsvdpagepktfunction rtl92c_set_fw_joinbss_report_cmdfunction rtl92c_set_p2p_ctw_period_cmdfunction set_noa_datafunction rtl92c_set_p2p_ps_offload_cmdexport rtl92c_download_fwexport rtl92c_fill_h2c_cmdexport rtl92c_firmware_selfresetexport rtl92c_set_fw_pwrmode_cmdexport rtl92c_set_fw_rsvdpagepktexport rtl92c_set_fw_joinbss_report_cmdexport rtl92c_set_p2p_ps_offload_cmd
Annotated Snippet
if (enable) {
tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1);
rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1,
tmp | 0x04);
tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL);
rtl_write_byte(rtlpriv, REG_MCUFWDL, tmp | 0x01);
tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL + 2);
rtl_write_byte(rtlpriv, REG_MCUFWDL + 2, tmp & 0xf7);
} else {
tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL);
rtl_write_byte(rtlpriv, REG_MCUFWDL, tmp & 0xfe);
rtl_write_byte(rtlpriv, REG_MCUFWDL + 1, 0x00);
}
}
}
static void _rtl92c_write_fw(struct ieee80211_hw *hw,
enum version_8192c version, u8 *buffer, u32 size)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
bool is_version_b;
u8 *bufferptr = (u8 *)buffer;
rtl_dbg(rtlpriv, COMP_FW, DBG_TRACE, "FW size is %d bytes,\n", size);
is_version_b = IS_NORMAL_CHIP(version);
if (is_version_b) {
u32 pagenums, remainsize;
u32 page, offset;
if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192CE)
rtl_fill_dummy(bufferptr, &size);
pagenums = size / FW_8192C_PAGE_SIZE;
remainsize = size % FW_8192C_PAGE_SIZE;
if (pagenums > 4)
pr_err("Page numbers should not greater then 4\n");
for (page = 0; page < pagenums; page++) {
offset = page * FW_8192C_PAGE_SIZE;
rtl_fw_page_write(hw, page, (bufferptr + offset),
FW_8192C_PAGE_SIZE);
}
if (remainsize) {
offset = pagenums * FW_8192C_PAGE_SIZE;
page = pagenums;
rtl_fw_page_write(hw, page, (bufferptr + offset),
remainsize);
}
} else {
rtl_fw_block_write(hw, buffer, size);
}
}
static int _rtl92c_fw_free_to_go(struct ieee80211_hw *hw)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
int err = -EIO;
u32 counter = 0;
u32 value32;
do {
value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL);
} while ((counter++ < FW_8192C_POLLING_TIMEOUT_COUNT) &&
(!(value32 & FWDL_CHKSUM_RPT)));
if (counter >= FW_8192C_POLLING_TIMEOUT_COUNT) {
pr_err("chksum report fail! REG_MCUFWDL:0x%08x .\n",
value32);
goto exit;
}
value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL);
value32 |= MCUFWDL_RDY;
value32 &= ~WINTINI_RDY;
rtl_write_dword(rtlpriv, REG_MCUFWDL, value32);
counter = 0;
do {
value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL);
if (value32 & WINTINI_RDY)
return 0;
mdelay(FW_8192C_POLLING_DELAY);
Annotation
- Immediate include surface: `../wifi.h`, `../pci.h`, `../base.h`, `../core.h`, `../efuse.h`, `../rtl8192ce/reg.h`, `../rtl8192ce/def.h`, `fw_common.h`.
- Detected declarations: `function _rtl92c_enable_fw_download`, `function _rtl92c_write_fw`, `function _rtl92c_fw_free_to_go`, `function rtl92c_download_fw`, `function _rtl92c_check_fw_read_last_h2c`, `function _rtl92c_fill_h2c_command`, `function rtl92c_fill_h2c_cmd`, `function rtl92c_firmware_selfreset`, `function rtl92c_set_fw_pwrmode_cmd`, `function rtl92c_set_fw_rsvdpagepkt`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.