drivers/bcma/driver_chipcommon_pmu.c
Source file repositories/reference/linux-study-clean/drivers/bcma/driver_chipcommon_pmu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/bcma/driver_chipcommon_pmu.c- Extension
.c- Size
- 19824 bytes
- Lines
- 671
- Domain
- Driver Families
- Bucket
- drivers/bcma
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
bcma_private.hlinux/export.hlinux/bcma/bcma.h
Detected Declarations
function bcma_chipco_pll_readfunction bcma_chipco_pll_writefunction bcma_chipco_pll_masksetfunction bcma_chipco_chipctl_masksetfunction bcma_chipco_regctl_masksetfunction bcma_pmu_xtalfreqfunction bcma_pmu2_pll_init0function bcma_pmu_pll_initfunction bcma_pmu_resources_initfunction bcma_chipco_bcm4331_ext_pa_lines_ctlfunction bcma_pmu_workaroundsfunction bcma_pmu_early_initfunction bcma_pmu_initfunction bcma_pmu_get_alp_clockfunction bcma_pmu_pll_clockfunction bcma_pmu_pll_clock_bcm4706function bcma_pmu_get_bus_clockfunction bcma_pmu_get_cpu_clockfunction bcma_pmu_spuravoid_pll_writefunction bcma_pmu_spuravoid_pllupdateexport bcma_chipco_pll_readexport bcma_chipco_pll_writeexport bcma_chipco_pll_masksetexport bcma_chipco_chipctl_masksetexport bcma_chipco_regctl_masksetexport bcma_pmu_get_bus_clockexport bcma_pmu_spuravoid_pllupdate
Annotated Snippet
switch (xtalfreq) {
case 12000:
freq_tgt_target = 0x50D52;
break;
case 20000:
freq_tgt_target = 0x307FE;
break;
case 26000:
freq_tgt_target = 0x254EA;
break;
case 37400:
freq_tgt_target = 0x19EF8;
break;
case 52000:
freq_tgt_target = 0x12A75;
break;
}
break;
}
if (!freq_tgt_target) {
bcma_err(bus, "Unknown TGT frequency for xtalfreq %d\n",
xtalfreq);
return;
}
pll0 = bcma_chipco_pll_read(cc, BCMA_CC_PMU15_PLL_PLLCTL0);
freq_tgt_current = (pll0 & BCMA_CC_PMU15_PLL_PC0_FREQTGT_MASK) >>
BCMA_CC_PMU15_PLL_PC0_FREQTGT_SHIFT;
if (freq_tgt_current == freq_tgt_target) {
bcma_debug(bus, "Target TGT frequency already set\n");
return;
}
/* Turn off PLL */
switch (bus->chipinfo.id) {
case BCMA_CHIP_ID_BCM43142:
mask = (u32)~(BCMA_RES_4314_HT_AVAIL |
BCMA_RES_4314_MACPHY_CLK_AVAIL);
bcma_pmu_mask32(cc, BCMA_CC_PMU_MINRES_MSK, mask);
bcma_pmu_mask32(cc, BCMA_CC_PMU_MAXRES_MSK, mask);
bcma_wait_value(cc->core, BCMA_CLKCTLST,
BCMA_CLKCTLST_HAVEHT, 0, 20000);
break;
}
pll0 &= ~BCMA_CC_PMU15_PLL_PC0_FREQTGT_MASK;
pll0 |= freq_tgt_target << BCMA_CC_PMU15_PLL_PC0_FREQTGT_SHIFT;
bcma_chipco_pll_write(cc, BCMA_CC_PMU15_PLL_PLLCTL0, pll0);
/* Flush */
if (cc->pmu.rev >= 2)
bcma_pmu_set32(cc, BCMA_CC_PMU_CTL, BCMA_CC_PMU_CTL_PLL_UPD);
/* TODO: Do we need to update OTP? */
}
static void bcma_pmu_pll_init(struct bcma_drv_cc *cc)
{
struct bcma_bus *bus = cc->core->bus;
u32 xtalfreq = bcma_pmu_xtalfreq(cc);
switch (bus->chipinfo.id) {
case BCMA_CHIP_ID_BCM43142:
if (xtalfreq == 0)
xtalfreq = 20000;
bcma_pmu2_pll_init0(cc, xtalfreq);
break;
}
}
static void bcma_pmu_resources_init(struct bcma_drv_cc *cc)
{
struct bcma_bus *bus = cc->core->bus;
u32 min_msk = 0, max_msk = 0;
switch (bus->chipinfo.id) {
case BCMA_CHIP_ID_BCM4313:
min_msk = 0x200D;
max_msk = 0xFFFF;
break;
case BCMA_CHIP_ID_BCM43142:
min_msk = BCMA_RES_4314_LPLDO_PU |
BCMA_RES_4314_PMU_SLEEP_DIS |
BCMA_RES_4314_PMU_BG_PU |
BCMA_RES_4314_CBUCK_LPOM_PU |
BCMA_RES_4314_CBUCK_PFM_PU |
BCMA_RES_4314_CLDO_PU |
Annotation
- Immediate include surface: `bcma_private.h`, `linux/export.h`, `linux/bcma/bcma.h`.
- Detected declarations: `function bcma_chipco_pll_read`, `function bcma_chipco_pll_write`, `function bcma_chipco_pll_maskset`, `function bcma_chipco_chipctl_maskset`, `function bcma_chipco_regctl_maskset`, `function bcma_pmu_xtalfreq`, `function bcma_pmu2_pll_init0`, `function bcma_pmu_pll_init`, `function bcma_pmu_resources_init`, `function bcma_chipco_bcm4331_ext_pa_lines_ctl`.
- Atlas domain: Driver Families / drivers/bcma.
- 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.