drivers/clk/clk-ep93xx.c
Source file repositories/reference/linux-study-clean/drivers/clk/clk-ep93xx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/clk-ep93xx.c- Extension
.c- Size
- 23588 bytes
- Lines
- 854
- 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.
- 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/bits.hlinux/cleanup.hlinux/clk-provider.hlinux/math.hlinux/platform_device.hlinux/regmap.hlinux/spinlock.hlinux/soc/cirrus/ep93xx.hdt-bindings/clock/cirrus,ep9301-syscon.hasm/div64.h
Detected Declarations
struct ep93xx_clkstruct ep93xx_clk_privstruct ep93xx_gatefunction ep93xx_clk_writefunction ep93xx_clk_is_enabledfunction ep93xx_clk_enablefunction ep93xx_clk_disablefunction ep93xx_clk_register_gatefunction ep93xx_mux_get_parentfunction ep93xx_mux_set_parent_lockfunction is_bestfunction ep93xx_mux_determine_ratefunction ep93xx_ddiv_recalc_ratefunction ep93xx_ddiv_set_ratefunction ep93xx_clk_register_ddivfunction ep93xx_div_recalc_ratefunction ep93xx_div_determine_ratefunction ep93xx_div_set_ratefunction ep93xx_register_divfunction ep93xx_uart_clock_initfunction ep93xx_dma_clock_initfunction calc_pll_ratefunction ep93xx_plls_initfunction ep93xx_clk_probe
Annotated Snippet
struct ep93xx_clk {
struct clk_hw hw;
u16 idx;
u16 reg;
u32 mask;
u8 bit_idx;
u8 shift;
u8 width;
u8 num_div;
const char *div;
};
struct ep93xx_clk_priv {
spinlock_t lock;
struct ep93xx_regmap_adev *aux_dev;
struct device *dev;
void __iomem *base;
struct regmap *map;
struct clk_hw *fixed[EP93XX_FIXED_CLK_COUNT];
struct ep93xx_clk reg[];
};
static struct ep93xx_clk *ep93xx_clk_from(struct clk_hw *hw)
{
return container_of(hw, struct ep93xx_clk, hw);
}
static struct ep93xx_clk_priv *ep93xx_priv_from(struct ep93xx_clk *clk)
{
return container_of(clk, struct ep93xx_clk_priv, reg[clk->idx]);
}
static void ep93xx_clk_write(struct ep93xx_clk_priv *priv, unsigned int reg, unsigned int val)
{
struct ep93xx_regmap_adev *aux = priv->aux_dev;
aux->write(aux->map, aux->lock, reg, val);
}
static int ep93xx_clk_is_enabled(struct clk_hw *hw)
{
struct ep93xx_clk *clk = ep93xx_clk_from(hw);
struct ep93xx_clk_priv *priv = ep93xx_priv_from(clk);
u32 val;
regmap_read(priv->map, clk->reg, &val);
return !!(val & BIT(clk->bit_idx));
}
static int ep93xx_clk_enable(struct clk_hw *hw)
{
struct ep93xx_clk *clk = ep93xx_clk_from(hw);
struct ep93xx_clk_priv *priv = ep93xx_priv_from(clk);
u32 val;
guard(spinlock_irqsave)(&priv->lock);
regmap_read(priv->map, clk->reg, &val);
val |= BIT(clk->bit_idx);
ep93xx_clk_write(priv, clk->reg, val);
return 0;
}
static void ep93xx_clk_disable(struct clk_hw *hw)
{
struct ep93xx_clk *clk = ep93xx_clk_from(hw);
struct ep93xx_clk_priv *priv = ep93xx_priv_from(clk);
u32 val;
guard(spinlock_irqsave)(&priv->lock);
regmap_read(priv->map, clk->reg, &val);
val &= ~BIT(clk->bit_idx);
ep93xx_clk_write(priv, clk->reg, val);
}
static const struct clk_ops clk_ep93xx_gate_ops = {
.enable = ep93xx_clk_enable,
.disable = ep93xx_clk_disable,
.is_enabled = ep93xx_clk_is_enabled,
};
static int ep93xx_clk_register_gate(struct ep93xx_clk *clk,
const char *name,
struct clk_parent_data *parent_data,
unsigned long flags,
Annotation
- Immediate include surface: `linux/bits.h`, `linux/cleanup.h`, `linux/clk-provider.h`, `linux/math.h`, `linux/platform_device.h`, `linux/regmap.h`, `linux/spinlock.h`, `linux/soc/cirrus/ep93xx.h`.
- Detected declarations: `struct ep93xx_clk`, `struct ep93xx_clk_priv`, `struct ep93xx_gate`, `function ep93xx_clk_write`, `function ep93xx_clk_is_enabled`, `function ep93xx_clk_enable`, `function ep93xx_clk_disable`, `function ep93xx_clk_register_gate`, `function ep93xx_mux_get_parent`, `function ep93xx_mux_set_parent_lock`.
- Atlas domain: Driver Families / drivers/clk.
- Implementation status: source 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.