drivers/clk/mvebu/armada-37xx-periph.c
Source file repositories/reference/linux-study-clean/drivers/clk/mvebu/armada-37xx-periph.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/mvebu/armada-37xx-periph.c- Extension
.c- Size
- 22912 bytes
- Lines
- 809
- 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/clk-provider.hlinux/io.hlinux/mfd/syscon.hlinux/of.hlinux/platform_device.hlinux/regmap.hlinux/slab.hlinux/jiffies.h
Detected Declarations
struct clk_periph_driver_datastruct clk_double_divstruct clk_pm_cpustruct clk_periph_datafunction get_divfunction clk_double_div_recalc_ratefunction armada_3700_pm_dvfs_update_regsfunction armada_3700_pm_dvfs_is_enabledfunction armada_3700_pm_dvfs_get_cpu_divfunction armada_3700_pm_dvfs_get_cpu_parentfunction clk_pm_cpu_get_parentfunction clk_pm_cpu_recalc_ratefunction clk_pm_cpu_determine_ratefunction frequenciesfunction clk_pm_cpu_set_ratefunction armada_3700_add_composite_clkfunction armada_3700_periph_clock_suspendfunction armada_3700_periph_clock_resumefunction armada_3700_periph_clock_probefunction armada_3700_periph_clock_remove
Annotated Snippet
struct clk_periph_driver_data {
struct clk_hw_onecell_data *hw_data;
spinlock_t lock;
void __iomem *reg;
/* Storage registers for suspend/resume operations */
u32 tbg_sel;
u32 div_sel0;
u32 div_sel1;
u32 div_sel2;
u32 clk_sel;
u32 clk_dis;
};
struct clk_double_div {
struct clk_hw hw;
void __iomem *reg1;
u8 shift1;
void __iomem *reg2;
u8 shift2;
};
struct clk_pm_cpu {
struct clk_hw hw;
void __iomem *reg_mux;
u8 shift_mux;
u32 mask_mux;
void __iomem *reg_div;
u8 shift_div;
struct regmap *nb_pm_base;
unsigned long l1_expiration;
};
#define to_clk_double_div(_hw) container_of(_hw, struct clk_double_div, hw)
#define to_clk_pm_cpu(_hw) container_of(_hw, struct clk_pm_cpu, hw)
struct clk_periph_data {
const char *name;
const char * const *parent_names;
int num_parents;
struct clk_hw *mux_hw;
struct clk_hw *rate_hw;
struct clk_hw *gate_hw;
struct clk_hw *muxrate_hw;
bool is_double_div;
};
static const struct clk_div_table clk_table6[] = {
{ .val = 1, .div = 1, },
{ .val = 2, .div = 2, },
{ .val = 3, .div = 3, },
{ .val = 4, .div = 4, },
{ .val = 5, .div = 5, },
{ .val = 6, .div = 6, },
{ .val = 0, .div = 0, }, /* last entry */
};
static const struct clk_div_table clk_table1[] = {
{ .val = 0, .div = 1, },
{ .val = 1, .div = 2, },
{ .val = 0, .div = 0, }, /* last entry */
};
static const struct clk_div_table clk_table2[] = {
{ .val = 0, .div = 2, },
{ .val = 1, .div = 4, },
{ .val = 0, .div = 0, }, /* last entry */
};
static const struct clk_ops clk_double_div_ops;
static const struct clk_ops clk_pm_cpu_ops;
#define __reg(__x) ((void __iomem __force *)(__x))
#define PERIPH_GATE(_name, _bit) \
struct clk_gate gate_##_name = { \
.reg = __reg(CLK_DIS), \
.bit_idx = _bit, \
.hw.init = &(struct clk_init_data){ \
.ops = &clk_gate_ops, \
} \
};
#define PERIPH_MUX(_name, _shift) \
struct clk_mux mux_##_name = { \
.reg = __reg(TBG_SEL), \
.shift = _shift, \
.mask = 3, \
.hw.init = &(struct clk_init_data){ \
.ops = &clk_mux_ro_ops, \
Annotation
- Immediate include surface: `linux/clk-provider.h`, `linux/io.h`, `linux/mfd/syscon.h`, `linux/of.h`, `linux/platform_device.h`, `linux/regmap.h`, `linux/slab.h`, `linux/jiffies.h`.
- Detected declarations: `struct clk_periph_driver_data`, `struct clk_double_div`, `struct clk_pm_cpu`, `struct clk_periph_data`, `function get_div`, `function clk_double_div_recalc_rate`, `function armada_3700_pm_dvfs_update_regs`, `function armada_3700_pm_dvfs_is_enabled`, `function armada_3700_pm_dvfs_get_cpu_div`, `function armada_3700_pm_dvfs_get_cpu_parent`.
- 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.