drivers/clk/ti/fapll.c
Source file repositories/reference/linux-study-clean/drivers/clk/ti/fapll.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/ti/fapll.c- Extension
.c- Size
- 15363 bytes
- Lines
- 673
- Domain
- Driver Families
- Bucket
- drivers/clk
- 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/clk.hlinux/clk-provider.hlinux/delay.hlinux/err.hlinux/io.hlinux/math64.hlinux/of.hlinux/of_address.hlinux/clk/ti.hclock.h
Detected Declarations
struct fapll_datastruct fapll_synthfunction ti_fapll_clock_is_bypassfunction ti_fapll_set_bypassfunction ti_fapll_clear_bypassfunction ti_fapll_wait_lockfunction ti_fapll_enablefunction ti_fapll_disablefunction ti_fapll_is_enabledfunction ti_fapll_recalc_ratefunction ti_fapll_get_parentfunction ti_fapll_set_div_multfunction ti_fapll_determine_ratefunction ti_fapll_set_ratefunction ti_fapll_synth_enablefunction ti_fapll_synth_disablefunction ti_fapll_synth_is_enabledfunction ti_fapll_synth_recalc_ratefunction ti_fapll_synth_get_frac_ratefunction ti_fapll_synth_set_frac_ratefunction ti_fapll_synth_determine_ratefunction ti_fapll_synth_set_ratefunction ti_fapll_synth_setupfunction ti_fapll_setup
Annotated Snippet
struct fapll_data {
struct clk_hw hw;
void __iomem *base;
const char *name;
struct clk *clk_ref;
struct clk *clk_bypass;
struct clk_onecell_data outputs;
bool bypass_bit_inverted;
};
struct fapll_synth {
struct clk_hw hw;
struct fapll_data *fd;
int index;
void __iomem *freq;
void __iomem *div;
const char *name;
struct clk *clk_pll;
};
static bool ti_fapll_clock_is_bypass(struct fapll_data *fd)
{
u32 v = readl_relaxed(fd->base);
if (fd->bypass_bit_inverted)
return !(v & FAPLL_MAIN_BP);
else
return !!(v & FAPLL_MAIN_BP);
}
static void ti_fapll_set_bypass(struct fapll_data *fd)
{
u32 v = readl_relaxed(fd->base);
if (fd->bypass_bit_inverted)
v &= ~FAPLL_MAIN_BP;
else
v |= FAPLL_MAIN_BP;
writel_relaxed(v, fd->base);
}
static void ti_fapll_clear_bypass(struct fapll_data *fd)
{
u32 v = readl_relaxed(fd->base);
if (fd->bypass_bit_inverted)
v |= FAPLL_MAIN_BP;
else
v &= ~FAPLL_MAIN_BP;
writel_relaxed(v, fd->base);
}
static int ti_fapll_wait_lock(struct fapll_data *fd)
{
int retries = FAPLL_MAX_RETRIES;
u32 v;
while ((v = readl_relaxed(fd->base))) {
if (v & FAPLL_MAIN_LOCK)
return 0;
if (retries-- <= 0)
break;
udelay(1);
}
pr_err("%s failed to lock\n", fd->name);
return -ETIMEDOUT;
}
static int ti_fapll_enable(struct clk_hw *hw)
{
struct fapll_data *fd = to_fapll(hw);
u32 v = readl_relaxed(fd->base);
v |= FAPLL_MAIN_PLLEN;
writel_relaxed(v, fd->base);
ti_fapll_wait_lock(fd);
return 0;
}
static void ti_fapll_disable(struct clk_hw *hw)
{
struct fapll_data *fd = to_fapll(hw);
u32 v = readl_relaxed(fd->base);
v &= ~FAPLL_MAIN_PLLEN;
Annotation
- Immediate include surface: `linux/clk.h`, `linux/clk-provider.h`, `linux/delay.h`, `linux/err.h`, `linux/io.h`, `linux/math64.h`, `linux/of.h`, `linux/of_address.h`.
- Detected declarations: `struct fapll_data`, `struct fapll_synth`, `function ti_fapll_clock_is_bypass`, `function ti_fapll_set_bypass`, `function ti_fapll_clear_bypass`, `function ti_fapll_wait_lock`, `function ti_fapll_enable`, `function ti_fapll_disable`, `function ti_fapll_is_enabled`, `function ti_fapll_recalc_rate`.
- Atlas domain: Driver Families / drivers/clk.
- 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.