drivers/net/wireless/realtek/rtlwifi/efuse.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/realtek/rtlwifi/efuse.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/realtek/rtlwifi/efuse.c- Extension
.c- Size
- 37041 bytes
- Lines
- 1374
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
wifi.hefuse.hpci.hlinux/export.h
Detected Declarations
function efuse_initializefunction efuse_read_1bytefunction efuse_write_1bytefunction read_efuse_bytefunction read_efusefunction efuse_shadow_update_chkfunction efuse_shadow_readfunction efuse_shadow_writefunction efuse_shadow_updatefunction rtl_efuse_shadow_map_updatefunction efuse_force_write_vendor_idfunction efuse_re_pg_sectionfunction efuse_shadow_read_2bytefunction efuse_shadow_read_4bytefunction efuse_shadow_write_1bytefunction efuse_shadow_write_2bytefunction efuse_shadow_write_4bytefunction efuse_one_byte_readfunction efuse_one_byte_writefunction efuse_read_all_mapfunction efuse_read_data_case1function efuse_pg_packet_readfunction efuse_write_data_case1function efuse_write_data_case2function efuse_pg_packet_writefunction efuse_word_enable_data_readfunction enable_efuse_data_writefunction efuse_power_switchfunction efuse_get_current_sizefunction efuse_calculate_word_cntsfunction rtl_get_hwinfofunction _rtl_fw_block_write_usbfunction rtl_fw_block_writefunction rtl_fw_page_writefunction rtl_fill_dummyfunction rtl_efuse_ops_initexport efuse_read_1byteexport read_efuse_byteexport efuse_shadow_readexport rtl_efuse_shadow_map_updateexport efuse_one_byte_readexport efuse_power_switchexport rtl_get_hwinfoexport rtl_fw_block_writeexport rtl_fw_page_writeexport rtl_fill_dummyexport rtl_efuse_ops_init
Annotated Snippet
while (!(bytetemp & 0x80)) {
bytetemp = rtl_read_byte(rtlpriv,
rtlpriv->cfg->
maps[EFUSE_CTRL] + 3);
k++;
if (k == 1000)
break;
}
data = rtl_read_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL]);
return data;
} else
return 0xFF;
}
EXPORT_SYMBOL(efuse_read_1byte);
void efuse_write_1byte(struct ieee80211_hw *hw, u16 address, u8 value)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
u8 bytetemp;
u8 temp;
u32 k = 0;
const u32 efuse_len =
rtlpriv->cfg->maps[EFUSE_REAL_CONTENT_SIZE];
rtl_dbg(rtlpriv, COMP_EFUSE, DBG_LOUD, "Addr=%x Data =%x\n",
address, value);
if (address < efuse_len) {
rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL], value);
temp = address & 0xFF;
rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL] + 1,
temp);
bytetemp = rtl_read_byte(rtlpriv,
rtlpriv->cfg->maps[EFUSE_CTRL] + 2);
temp = ((address >> 8) & 0x03) | (bytetemp & 0xFC);
rtl_write_byte(rtlpriv,
rtlpriv->cfg->maps[EFUSE_CTRL] + 2, temp);
bytetemp = rtl_read_byte(rtlpriv,
rtlpriv->cfg->maps[EFUSE_CTRL] + 3);
temp = bytetemp | 0x80;
rtl_write_byte(rtlpriv,
rtlpriv->cfg->maps[EFUSE_CTRL] + 3, temp);
bytetemp = rtl_read_byte(rtlpriv,
rtlpriv->cfg->maps[EFUSE_CTRL] + 3);
while (bytetemp & 0x80) {
bytetemp = rtl_read_byte(rtlpriv,
rtlpriv->cfg->
maps[EFUSE_CTRL] + 3);
k++;
if (k == 100) {
k = 0;
break;
}
}
}
}
void read_efuse_byte(struct ieee80211_hw *hw, u16 _offset, u8 *pbuf)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
u16 max_attempts = 10000;
u32 value32;
u8 readbyte;
u16 retry;
/*
* In case of USB devices, transfer speeds are limited, hence
* efuse I/O reads could be (way) slower. So, decrease (a lot)
* the read attempts in case of failures.
*/
if (rtlpriv->rtlhal.interface == INTF_USB)
max_attempts = 10;
rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL] + 1,
(_offset & 0xff));
readbyte = rtl_read_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL] + 2);
rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL] + 2,
((_offset >> 8) & 0x03) | (readbyte & 0xfc));
readbyte = rtl_read_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL] + 3);
rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL] + 3,
(readbyte & 0x7f));
Annotation
- Immediate include surface: `wifi.h`, `efuse.h`, `pci.h`, `linux/export.h`.
- Detected declarations: `function efuse_initialize`, `function efuse_read_1byte`, `function efuse_write_1byte`, `function read_efuse_byte`, `function read_efuse`, `function efuse_shadow_update_chk`, `function efuse_shadow_read`, `function efuse_shadow_write`, `function efuse_shadow_update`, `function rtl_efuse_shadow_map_update`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration implementation candidate.
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.