drivers/clk/ralink/clk-mtmips.c
Source file repositories/reference/linux-study-clean/drivers/clk/ralink/clk-mtmips.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/ralink/clk-mtmips.c- Extension
.c- Size
- 29646 bytes
- Lines
- 1133
- 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/bitops.hlinux/clk-provider.hlinux/mfd/syscon.hlinux/platform_device.hlinux/regmap.hlinux/reset-controller.hlinux/slab.h
Detected Declarations
struct mtmips_clkstruct mtmips_clk_fixedstruct mtmips_clk_factorstruct mtmips_clk_datastruct mtmips_clk_privstruct mtmips_clkstruct mtmips_clk_fixedstruct mtmips_clk_factorstruct mtmips_rstfunction mtmips_pherip_clk_ratefunction mtmips_register_pherip_clocksfunction mtmips_register_fixed_clocksfunction mtmips_register_factor_clocksfunction rt2880_xtal_recalc_ratefunction rt5350_xtal_recalc_ratefunction rt5350_cpu_recalc_ratefunction rt5350_bus_recalc_ratefunction rt3352_cpu_recalc_ratefunction rt305x_cpu_recalc_ratefunction rt3883_cpu_recalc_ratefunction rt3883_bus_recalc_ratefunction rt2880_cpu_recalc_ratefunction mt7620_calc_ratefunction mt7620_pll_recalc_ratefunction mt7620_cpu_recalc_ratefunction mt7620_bus_recalc_ratefunction mt7620_periph_recalc_ratefunction mt76x8_xtal_recalc_ratefunction mt76x8_cpu_recalc_ratefunction mtmips_register_clocksfunction mtmips_clk_regs_initfunction mtmips_clk_initfunction mtmips_assert_devicefunction mtmips_deassert_devicefunction mtmips_reset_devicefunction mtmips_rst_xlatefunction mtmips_reset_initfunction mtmips_clk_probefunction mtmips_clk_reset_init
Annotated Snippet
struct mtmips_clk_data {
struct mtmips_clk *clk_base;
size_t num_clk_base;
struct mtmips_clk_fixed *clk_fixed;
size_t num_clk_fixed;
struct mtmips_clk_factor *clk_factor;
size_t num_clk_factor;
struct mtmips_clk *clk_periph;
size_t num_clk_periph;
};
struct mtmips_clk_priv {
struct regmap *sysc;
const struct mtmips_clk_data *data;
};
struct mtmips_clk {
struct clk_hw hw;
struct mtmips_clk_priv *priv;
};
struct mtmips_clk_fixed {
const char *name;
const char *parent;
unsigned long rate;
struct clk_hw *hw;
};
struct mtmips_clk_factor {
const char *name;
const char *parent;
int mult;
int div;
unsigned long flags;
struct clk_hw *hw;
};
static unsigned long mtmips_pherip_clk_rate(struct clk_hw *hw,
unsigned long parent_rate)
{
return parent_rate;
}
static const struct clk_ops mtmips_periph_clk_ops = {
.recalc_rate = mtmips_pherip_clk_rate,
};
#define CLK_PERIPH(_name, _parent) { \
.init = &(const struct clk_init_data) { \
.name = _name, \
.ops = &mtmips_periph_clk_ops, \
.parent_data = &(const struct clk_parent_data) {\
.name = _parent, \
.fw_name = _parent \
}, \
.num_parents = 1, \
/* \
* There are drivers for these SoCs that are \
* older than clock driver and are not prepared \
* for the clock. We don't want the kernel to \
* disable anything so we add CLK_IS_CRITICAL \
* flag here. \
*/ \
.flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL \
}, \
}
static struct mtmips_clk rt2880_pherip_clks[] = {
{ CLK_PERIPH("300100.timer", "bus") },
{ CLK_PERIPH("300120.watchdog", "bus") },
{ CLK_PERIPH("300500.uart", "bus") },
{ CLK_PERIPH("300900.i2c", "bus") },
{ CLK_PERIPH("300c00.uartlite", "bus") },
{ CLK_PERIPH("400000.ethernet", "bus") },
{ CLK_PERIPH("480000.wmac", "xtal") }
};
static struct mtmips_clk rt305x_pherip_clks[] = {
{ CLK_PERIPH("10000100.timer", "bus") },
{ CLK_PERIPH("10000120.watchdog", "bus") },
{ CLK_PERIPH("10000500.uart", "bus") },
{ CLK_PERIPH("10000900.i2c", "bus") },
{ CLK_PERIPH("10000a00.i2s", "bus") },
{ CLK_PERIPH("10000b00.spi", "bus") },
{ CLK_PERIPH("10000b40.spi", "bus") },
{ CLK_PERIPH("10000c00.uartlite", "bus") },
{ CLK_PERIPH("10100000.ethernet", "bus") },
{ CLK_PERIPH("10180000.wmac", "xtal") }
};
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/clk-provider.h`, `linux/mfd/syscon.h`, `linux/platform_device.h`, `linux/regmap.h`, `linux/reset-controller.h`, `linux/slab.h`.
- Detected declarations: `struct mtmips_clk`, `struct mtmips_clk_fixed`, `struct mtmips_clk_factor`, `struct mtmips_clk_data`, `struct mtmips_clk_priv`, `struct mtmips_clk`, `struct mtmips_clk_fixed`, `struct mtmips_clk_factor`, `struct mtmips_rst`, `function mtmips_pherip_clk_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.