drivers/net/wireless/ralink/rt2x00/rt2800lib.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ralink/rt2x00/rt2800lib.c- Extension
.c- Size
- 391851 bytes
- Lines
- 12347
- 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.
- 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
linux/crc-ccitt.hlinux/kernel.hlinux/module.hlinux/nvmem-consumer.hlinux/slab.hrt2x00.hrt2800lib.hrt2800.h
Detected Declarations
function rt2800_is_305x_socfunction rt2800_bbp_writefunction rt2800_bbp_readfunction rt2800_rfcsr_writefunction rt2800_rfcsr_write_bankfunction rt2800_rfcsr_write_chanregfunction rt2800_rfcsr_write_dccalfunction rt2800_bbp_dcoc_writefunction rt2800_bbp_dcoc_readfunction rt2800_bbp_glrt_writefunction rt2800_rfcsr_readfunction rt2800_rfcsr_read_bankfunction rt2800_rf_writefunction rt2800_eeprom_word_indexfunction rt2800_eeprom_readfunction rt2800_eeprom_writefunction rt2800_eeprom_read_from_arrayfunction rt2800_enable_wlan_rt3290function rt2800_mcu_requestfunction rt2800_wait_csr_readyfunction rt2800_wait_wpdma_readyfunction rt2800_disable_wpdmafunction rt2800_get_txwi_rxwi_sizefunction rt2800_check_firmware_crcfunction rt2800_check_firmwarefunction rt2800_load_firmwarefunction rt2800_write_tx_datafunction rt2800_agc_to_rssifunction rt2800_process_rxwifunction rt2800_rate_from_statusfunction rt2800_txdone_entry_checkfunction rt2800_txdone_entryfunction rt2800_txdonefunction rt2800_entry_txstatus_timeoutfunction rt2800_txstatus_timeoutfunction tx_queue_for_eachfunction rt2800_txstatus_pendingfunction tx_queue_for_eachfunction rt2800_txdone_nostatusfunction rt2800_check_hungfunction rt2800_update_surveyfunction rt2800_watchdog_hungfunction queue_for_eachfunction rt2800_watchdog_dma_busyfunction rt2800_watchdogfunction rt2800_hw_beacon_basefunction rt2800_get_beacon_offsetfunction rt2800_update_beacons_setup
Annotated Snippet
if (WAIT_FOR_RFCSR_MT7620(rt2x00dev, ®)) {
reg = 0;
rt2x00_set_field32(®, RF_CSR_CFG_DATA_MT7620, value);
rt2x00_set_field32(®, RF_CSR_CFG_REGNUM_MT7620,
word);
rt2x00_set_field32(®, RF_CSR_CFG_WRITE_MT7620, 1);
rt2x00_set_field32(®, RF_CSR_CFG_BUSY_MT7620, 1);
rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
}
break;
default:
if (WAIT_FOR_RFCSR(rt2x00dev, ®)) {
reg = 0;
rt2x00_set_field32(®, RF_CSR_CFG_DATA, value);
rt2x00_set_field32(®, RF_CSR_CFG_REGNUM, word);
rt2x00_set_field32(®, RF_CSR_CFG_WRITE, 1);
rt2x00_set_field32(®, RF_CSR_CFG_BUSY, 1);
rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
}
break;
}
mutex_unlock(&rt2x00dev->csr_mutex);
}
static void rt2800_rfcsr_write_bank(struct rt2x00_dev *rt2x00dev, const u8 bank,
const unsigned int reg, const u8 value)
{
rt2800_rfcsr_write(rt2x00dev, (reg | (bank << 6)), value);
}
static void rt2800_rfcsr_write_chanreg(struct rt2x00_dev *rt2x00dev,
const unsigned int reg, const u8 value)
{
rt2800_rfcsr_write_bank(rt2x00dev, 4, reg, value);
rt2800_rfcsr_write_bank(rt2x00dev, 6, reg, value);
}
static void rt2800_rfcsr_write_dccal(struct rt2x00_dev *rt2x00dev,
const unsigned int reg, const u8 value)
{
rt2800_rfcsr_write_bank(rt2x00dev, 5, reg, value);
rt2800_rfcsr_write_bank(rt2x00dev, 7, reg, value);
}
static void rt2800_bbp_dcoc_write(struct rt2x00_dev *rt2x00dev,
const u8 reg, const u8 value)
{
rt2800_bbp_write(rt2x00dev, 158, reg);
rt2800_bbp_write(rt2x00dev, 159, value);
}
static u8 rt2800_bbp_dcoc_read(struct rt2x00_dev *rt2x00dev, const u8 reg)
{
rt2800_bbp_write(rt2x00dev, 158, reg);
return rt2800_bbp_read(rt2x00dev, 159);
}
static void rt2800_bbp_glrt_write(struct rt2x00_dev *rt2x00dev,
const u8 reg, const u8 value)
{
rt2800_bbp_write(rt2x00dev, 195, reg);
rt2800_bbp_write(rt2x00dev, 196, value);
}
static u8 rt2800_rfcsr_read(struct rt2x00_dev *rt2x00dev,
const unsigned int word)
{
u32 reg;
u8 value;
mutex_lock(&rt2x00dev->csr_mutex);
/*
* Wait until the RFCSR becomes available, afterwards we
* can safely write the read request into the register.
* After the data has been written, we wait until hardware
* returns the correct value, if at any time the register
* doesn't become available in time, reg will be 0xffffffff
* which means we return 0xff to the caller.
*/
switch (rt2x00dev->chip.rt) {
case RT6352:
if (WAIT_FOR_RFCSR_MT7620(rt2x00dev, ®)) {
reg = 0;
rt2x00_set_field32(®, RF_CSR_CFG_REGNUM_MT7620,
word);
Annotation
- Immediate include surface: `linux/crc-ccitt.h`, `linux/kernel.h`, `linux/module.h`, `linux/nvmem-consumer.h`, `linux/slab.h`, `rt2x00.h`, `rt2800lib.h`, `rt2800.h`.
- Detected declarations: `function rt2800_is_305x_soc`, `function rt2800_bbp_write`, `function rt2800_bbp_read`, `function rt2800_rfcsr_write`, `function rt2800_rfcsr_write_bank`, `function rt2800_rfcsr_write_chanreg`, `function rt2800_rfcsr_write_dccal`, `function rt2800_bbp_dcoc_write`, `function rt2800_bbp_dcoc_read`, `function rt2800_bbp_glrt_write`.
- 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.