drivers/net/wireless/broadcom/b43/phy_lp.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/broadcom/b43/phy_lp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/broadcom/b43/phy_lp.c- Extension
.c- Size
- 98055 bytes
- Lines
- 2694
- 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/cordic.hlinux/slab.hb43.hmain.hphy_lp.hphy_common.htables_lpphy.h
Detected Declarations
struct b2062_freqdatastruct lpphy_stx_table_entrystruct lpphy_iq_eststruct lpphy_tx_gainsstruct lpphy_rx_iq_compstruct b206x_channelfunction Copyrightfunction b43_lpphy_op_get_default_chanfunction b43_lpphy_op_allocatefunction b43_lpphy_op_prepare_structsfunction b43_lpphy_op_freefunction lpphy_read_band_spromfunction lpphy_adjust_gain_tablefunction lpphy_table_initfunction lpphy_baseband_rev0_1_initfunction lpphy_save_dig_flt_statefunction lpphy_restore_dig_flt_statefunction lpphy_baseband_rev2plus_initfunction lpphy_baseband_initfunction lpphy_2062_initfunction lpphy_2063_initfunction lpphy_sync_stxfunction lpphy_radio_initfunction lpphy_set_rc_capfunction lpphy_get_bb_multfunction lpphy_set_bb_multfunction lpphy_set_deaffunction lpphy_clear_deaffunction lpphy_set_trsw_overfunction lpphy_disable_crsfunction lpphy_restore_crsfunction lpphy_disable_rx_gain_overridefunction lpphy_enable_rx_gain_overridefunction lpphy_disable_tx_gain_overridefunction lpphy_enable_tx_gain_overridefunction lpphy_get_tx_gainsfunction lpphy_set_dac_gainfunction lpphy_get_pa_gainfunction lpphy_set_pa_gainfunction lpphy_set_tx_gainsfunction lpphy_rev0_1_set_rx_gainfunction lpphy_rev2plus_set_rx_gainfunction lpphy_set_rx_gainfunction lpphy_set_rx_gain_by_indexfunction lpphy_stop_ddfsfunction lpphy_run_ddfsfunction lpphy_rx_iq_estfunction lpphy_loopback
Annotated Snippet
struct b2062_freqdata {
u16 freq;
u8 data[6];
};
/* Initialize the 2062 radio. */
static void lpphy_2062_init(struct b43_wldev *dev)
{
struct b43_phy_lp *lpphy = dev->phy.lp;
struct ssb_bus *bus = dev->dev->sdev->bus;
u32 crystalfreq, tmp, ref;
unsigned int i;
const struct b2062_freqdata *fd = NULL;
static const struct b2062_freqdata freqdata_tab[] = {
{ .freq = 12000, .data[0] = 6, .data[1] = 6, .data[2] = 6,
.data[3] = 6, .data[4] = 10, .data[5] = 6, },
{ .freq = 13000, .data[0] = 4, .data[1] = 4, .data[2] = 4,
.data[3] = 4, .data[4] = 11, .data[5] = 7, },
{ .freq = 14400, .data[0] = 3, .data[1] = 3, .data[2] = 3,
.data[3] = 3, .data[4] = 12, .data[5] = 7, },
{ .freq = 16200, .data[0] = 3, .data[1] = 3, .data[2] = 3,
.data[3] = 3, .data[4] = 13, .data[5] = 8, },
{ .freq = 18000, .data[0] = 2, .data[1] = 2, .data[2] = 2,
.data[3] = 2, .data[4] = 14, .data[5] = 8, },
{ .freq = 19200, .data[0] = 1, .data[1] = 1, .data[2] = 1,
.data[3] = 1, .data[4] = 14, .data[5] = 9, },
};
b2062_upload_init_table(dev);
b43_radio_write(dev, B2062_N_TX_CTL3, 0);
b43_radio_write(dev, B2062_N_TX_CTL4, 0);
b43_radio_write(dev, B2062_N_TX_CTL5, 0);
b43_radio_write(dev, B2062_N_TX_CTL6, 0);
b43_radio_write(dev, B2062_N_PDN_CTL0, 0x40);
b43_radio_write(dev, B2062_N_PDN_CTL0, 0);
b43_radio_write(dev, B2062_N_CALIB_TS, 0x10);
b43_radio_write(dev, B2062_N_CALIB_TS, 0);
if (dev->phy.rev > 0) {
b43_radio_write(dev, B2062_S_BG_CTL1,
(b43_radio_read(dev, B2062_N_COMM2) >> 1) | 0x80);
}
if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
b43_radio_set(dev, B2062_N_TSSI_CTL0, 0x1);
else
b43_radio_mask(dev, B2062_N_TSSI_CTL0, ~0x1);
/* Get the crystal freq, in Hz. */
crystalfreq = bus->chipco.pmu.crystalfreq * 1000;
B43_WARN_ON(!(bus->chipco.capabilities & SSB_CHIPCO_CAP_PMU));
B43_WARN_ON(crystalfreq == 0);
if (crystalfreq <= 30000000) {
lpphy->pdiv = 1;
b43_radio_mask(dev, B2062_S_RFPLL_CTL1, 0xFFFB);
} else {
lpphy->pdiv = 2;
b43_radio_set(dev, B2062_S_RFPLL_CTL1, 0x4);
}
tmp = (((800000000 * lpphy->pdiv + crystalfreq) /
(2 * crystalfreq)) - 8) & 0xFF;
b43_radio_write(dev, B2062_S_RFPLL_CTL7, tmp);
tmp = (((100 * crystalfreq + 16000000 * lpphy->pdiv) /
(32000000 * lpphy->pdiv)) - 1) & 0xFF;
b43_radio_write(dev, B2062_S_RFPLL_CTL18, tmp);
tmp = (((2 * crystalfreq + 1000000 * lpphy->pdiv) /
(2000000 * lpphy->pdiv)) - 1) & 0xFF;
b43_radio_write(dev, B2062_S_RFPLL_CTL19, tmp);
ref = (1000 * lpphy->pdiv + 2 * crystalfreq) / (2000 * lpphy->pdiv);
ref &= 0xFFFF;
for (i = 0; i < ARRAY_SIZE(freqdata_tab); i++) {
if (ref < freqdata_tab[i].freq) {
fd = &freqdata_tab[i];
break;
}
}
if (!fd)
fd = &freqdata_tab[ARRAY_SIZE(freqdata_tab) - 1];
b43dbg(dev->wl, "b2062: Using crystal tab entry %u kHz.\n",
fd->freq); /* FIXME: Keep this printk until the code is fully debugged. */
b43_radio_write(dev, B2062_S_RFPLL_CTL8,
((u16)(fd->data[1]) << 4) | fd->data[0]);
b43_radio_write(dev, B2062_S_RFPLL_CTL9,
Annotation
- Immediate include surface: `linux/cordic.h`, `linux/slab.h`, `b43.h`, `main.h`, `phy_lp.h`, `phy_common.h`, `tables_lpphy.h`.
- Detected declarations: `struct b2062_freqdata`, `struct lpphy_stx_table_entry`, `struct lpphy_iq_est`, `struct lpphy_tx_gains`, `struct lpphy_rx_iq_comp`, `struct b206x_channel`, `function Copyright`, `function b43_lpphy_op_get_default_chan`, `function b43_lpphy_op_allocate`, `function b43_lpphy_op_prepare_structs`.
- 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.