![]() |
RT-Thread RTOS
An open source embedded real-time operating system
|
Implementation: **components/drivers/clk/clk-fixed-rate.c**. Driver name: **clk-fixed-rate**. Overview: Clock framework (CLK).
Registers a constant-frequency, always-on clock with no gate, parent, or rate programming — the leaf most SoC trees hang PLLs from.
Consumers:
With **#clock-cells = <0>**, the specifier in **clocks = <&osc24m>** has no extra integers (implicit index 0).
rt_platform_driver_register** via **INIT_SUBSYS_EXPORT(fixed_clk_drv_register)** — early registration so crystal nodes probe before CCM consumers.fixed_clk_probe**: rt_calloc **struct clk_fixed** (embeds **rt_clk_node** + one **rt_clk_fixed_rate**).rt_dm_dev_prop_read_u32(dev, "clock-frequency", &val)** — required; probe fails without it.clock-accuracy**, **clock-output-names** → **fcell.cell.name**.cells[0]**, **fixed_clk_ops** (only **.recalc_rate**).rt_clk_register(&cf->parent)** — may run **rt_ofw_clk_set_defaults** if the fixed-clock node has **assigned-clocks*** (unusual on leaf osc).| Member | Role |
|---|---|
**fixed_rate** | Hz from **clock-frequency** |
**fixed_accuracy** | Optional ppb from DT |
**cell.ops->recalc_rate** | Returns **fixed_rate**; ignores parent |
No **enable/disable/prepare** — enabling is a no-op at ops level; framework refcount still works for consumers.
Linux-compatible binding; same node can be shared across BSP DTS and upstream dt-bindings.
Use **fixed-clock** | Use SoC driver (e.g. rockchip,*-cru) |
|---|---|
| Crystal, RC oscillator, external clock input | PLL, mux, divider, gate |
| Rate fixed at boot | DVFS, dynamic reparent |
| No MMIO (or MMIO not managed here) | Large clock controller IP |
Fixed clocks rarely need **rt_clk_set_rate** — rate is fixed; **rt_clk_get_rate** reads **recalc_rate**.
clock-frequency — probe fails, phandle resolution returns NULL for consumers.fixed-clock for gated peripherals — use a gate driver cell instead.clock-output-names** should be unique enough for **rt_clk_get_by_name** fallback lookup.components/drivers/clk/clk-fixed-rate.ccomponents/drivers/include/drivers/clk.h