drivers/net/wireless/broadcom/b43legacy/phy.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/broadcom/b43legacy/phy.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/broadcom/b43legacy/phy.c- Extension
.c- Size
- 65200 bytes
- Lines
- 2234
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- 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/delay.hlinux/pci.hlinux/sched.hlinux/slab.hlinux/types.hb43legacy.hphy.hmain.hradio.hilt.h
Detected Declarations
function b43legacy_phy_lockfunction b43legacy_phy_unlockfunction b43legacy_phy_readfunction b43legacy_phy_writefunction b43legacy_phy_calibratefunction b43legacy_phy_init_pctlfunction b43legacy_phy_agcsetupfunction b43legacy_phy_setupgfunction b43legacy_phy_initafunction b43legacy_phy_initb2function b43legacy_phy_initb4function b43legacy_phy_initb5function b43legacy_phy_initb6function b43legacy_calc_loopback_gainfunction b43legacy_phy_initgfunction b43legacy_phy_lo_b_r15_loopfunction b43legacy_phy_lo_b_measurefunction b43legacy_phy_lo_g_deviation_subvalfunction b43legacy_phy_lo_g_singledeviationfunction b43legacy_lo_writefunction b43legacy_phy_lo_adjustfunction b43legacy_phy_lo_g_measure_txctl2function b43legacy_phy_lo_g_statefunction b43legacy_phy_set_baseband_attenuationfunction b43legacy_phy_lo_g_measurefunction b43legacy_phy_lo_mark_current_usedfunction b43legacy_phy_lo_mark_all_unusedfunction b43legacy_phy_estimate_power_outfunction b43legacy_phy_xmitpowerfunction b43legacy_tssi2dbm_adfunction b43legacy_tssi2dbm_entryfunction b43legacy_phy_init_tssi2dbm_tablefunction b43legacy_phy_initfunction b43legacy_phy_set_antenna_diversityfunction b43legacy_power_saving_ctl_bits
Annotated Snippet
if (phy->rev == 2) {
b43legacy_phy_write(dev, 0x04C0, 0x1861);
b43legacy_phy_write(dev, 0x04C1, 0x0271);
} else if (phy->rev > 2) {
b43legacy_phy_write(dev, 0x04C0, 0x0098);
b43legacy_phy_write(dev, 0x04C1, 0x0070);
b43legacy_phy_write(dev, 0x04C9, 0x0080);
}
b43legacy_phy_write(dev, 0x042B, b43legacy_phy_read(dev,
0x042B) | 0x800);
for (i = 0; i < 64; i++)
b43legacy_ilt_write(dev, 0x4000 + i, i);
for (i = 0; i < B43legacy_ILT_NOISEG2_SIZE; i++)
b43legacy_ilt_write(dev, 0x1800 + i,
b43legacy_ilt_noiseg2[i]);
}
if (phy->rev <= 2)
for (i = 0; i < B43legacy_ILT_NOISESCALEG_SIZE; i++)
b43legacy_ilt_write(dev, 0x1400 + i,
b43legacy_ilt_noisescaleg1[i]);
else if ((phy->rev >= 7) && (b43legacy_phy_read(dev, 0x0449) & 0x0200))
for (i = 0; i < B43legacy_ILT_NOISESCALEG_SIZE; i++)
b43legacy_ilt_write(dev, 0x1400 + i,
b43legacy_ilt_noisescaleg3[i]);
else
for (i = 0; i < B43legacy_ILT_NOISESCALEG_SIZE; i++)
b43legacy_ilt_write(dev, 0x1400 + i,
b43legacy_ilt_noisescaleg2[i]);
if (phy->rev == 2)
for (i = 0; i < B43legacy_ILT_SIGMASQR_SIZE; i++)
b43legacy_ilt_write(dev, 0x5000 + i,
b43legacy_ilt_sigmasqr1[i]);
else if ((phy->rev > 2) && (phy->rev <= 8))
for (i = 0; i < B43legacy_ILT_SIGMASQR_SIZE; i++)
b43legacy_ilt_write(dev, 0x5000 + i,
b43legacy_ilt_sigmasqr2[i]);
if (phy->rev == 1) {
for (i = 0; i < B43legacy_ILT_RETARD_SIZE; i++)
b43legacy_ilt_write32(dev, 0x2400 + i,
b43legacy_ilt_retard[i]);
for (i = 4; i < 20; i++)
b43legacy_ilt_write(dev, 0x5400 + i, 0x0020);
b43legacy_phy_agcsetup(dev);
if (is_bcm_board_vendor(dev) &&
(dev->dev->bus->boardinfo.type == 0x0416) &&
(dev->dev->bus->sprom.board_rev == 0x0017))
return;
b43legacy_ilt_write(dev, 0x5001, 0x0002);
b43legacy_ilt_write(dev, 0x5002, 0x0001);
} else {
for (i = 0; i <= 0x20; i++)
b43legacy_ilt_write(dev, 0x1000 + i, 0x0820);
b43legacy_phy_agcsetup(dev);
b43legacy_phy_read(dev, 0x0400); /* dummy read */
b43legacy_phy_write(dev, 0x0403, 0x1000);
b43legacy_ilt_write(dev, 0x3C02, 0x000F);
b43legacy_ilt_write(dev, 0x3C03, 0x0014);
if (is_bcm_board_vendor(dev) &&
(dev->dev->bus->boardinfo.type == 0x0416) &&
(dev->dev->bus->sprom.board_rev == 0x0017))
return;
b43legacy_ilt_write(dev, 0x0401, 0x0002);
b43legacy_ilt_write(dev, 0x0402, 0x0001);
}
}
/* Initialize the APHY portion of a GPHY. */
static void b43legacy_phy_inita(struct b43legacy_wldev *dev)
{
might_sleep();
b43legacy_phy_setupg(dev);
if (dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_PACTRL)
b43legacy_phy_write(dev, 0x046E, 0x03CF);
}
static void b43legacy_phy_initb2(struct b43legacy_wldev *dev)
{
struct b43legacy_phy *phy = &dev->phy;
u16 offset;
int val;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/pci.h`, `linux/sched.h`, `linux/slab.h`, `linux/types.h`, `b43legacy.h`, `phy.h`, `main.h`.
- Detected declarations: `function b43legacy_phy_lock`, `function b43legacy_phy_unlock`, `function b43legacy_phy_read`, `function b43legacy_phy_write`, `function b43legacy_phy_calibrate`, `function b43legacy_phy_init_pctl`, `function b43legacy_phy_agcsetup`, `function b43legacy_phy_setupg`, `function b43legacy_phy_inita`, `function b43legacy_phy_initb2`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.