drivers/clk/imx/clk-scu.c
Source file repositories/reference/linux-study-clean/drivers/clk/imx/clk-scu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/imx/clk-scu.c- Extension
.c- Size
- 21769 bytes
- Lines
- 923
- Domain
- Driver Families
- Bucket
- drivers/clk
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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
dt-bindings/firmware/imx/rsrc.hlinux/arm-smccc.hlinux/bsearch.hlinux/clk-provider.hlinux/err.hlinux/of.hlinux/firmware/imx/svc/rm.hlinux/platform_device.hlinux/pm_domain.hlinux/pm_runtime.hlinux/slab.hxen/xen.hclk-scu.h
Detected Declarations
struct imx_scu_clk_nodestruct clk_scustruct clk_gpr_scustruct imx_sc_msg_req_set_clock_ratestruct req_get_clock_ratestruct resp_get_clock_ratestruct imx_sc_msg_get_clock_ratestruct imx_sc_msg_get_clock_parentstruct req_get_clock_parentstruct resp_get_clock_parentstruct imx_sc_msg_set_clock_parentstruct imx_sc_msg_req_clock_enablefunction imx_scu_clk_search_cmpfunction imx_scu_clk_is_validfunction imx_clk_scu_module_initfunction imx_clk_scu_module_exitfunction imx_clk_scu_initfunction clk_scu_recalc_ratefunction clk_scu_determine_ratefunction clk_scu_atf_set_cpu_ratefunction clk_scu_set_ratefunction clk_scu_get_parentfunction clk_scu_set_parentfunction sc_pm_clock_enablefunction clk_scu_preparefunction clk_scu_unpreparefunction list_for_each_entryfunction imx_clk_scu_probefunction imx_clk_scu_suspendfunction imx_clk_scu_resumefunction imx_clk_scu_attach_pdfunction imx_clk_is_resource_ownedfunction imx_clk_scu_unregisterfunction list_for_each_entry_safefunction clk_gpr_div_scu_recalc_ratefunction clk_gpr_div_scu_determine_ratefunction clk_gpr_div_scu_set_ratefunction clk_gpr_mux_scu_get_parentfunction clk_gpr_mux_scu_set_parentfunction clk_gpr_gate_scu_preparefunction clk_gpr_gate_scu_unpreparefunction clk_gpr_gate_scu_is_prepared
Annotated Snippet
struct imx_scu_clk_node {
const char *name;
u32 rsrc;
u8 clk_type;
const char * const *parents;
int num_parents;
struct clk_hw *hw;
struct list_head node;
};
struct list_head imx_scu_clks[IMX_SC_R_LAST];
/*
* struct clk_scu - Description of one SCU clock
* @hw: the common clk_hw
* @rsrc_id: resource ID of this SCU clock
* @clk_type: type of this clock resource
*/
struct clk_scu {
struct clk_hw hw;
u16 rsrc_id;
u8 clk_type;
/* for state save&restore */
struct clk_hw *parent;
u8 parent_index;
bool is_enabled;
u32 rate;
};
/*
* struct clk_gpr_scu - Description of one SCU GPR clock
* @hw: the common clk_hw
* @rsrc_id: resource ID of this SCU clock
* @gpr_id: GPR ID index to control the divider
*/
struct clk_gpr_scu {
struct clk_hw hw;
u16 rsrc_id;
u8 gpr_id;
u8 flags;
bool gate_invert;
};
#define to_clk_gpr_scu(_hw) container_of(_hw, struct clk_gpr_scu, hw)
/*
* struct imx_sc_msg_req_set_clock_rate - clock set rate protocol
* @hdr: SCU protocol header
* @rate: rate to set
* @resource: clock resource to set rate
* @clk: clk type of this resource
*
* This structure describes the SCU protocol of clock rate set
*/
struct imx_sc_msg_req_set_clock_rate {
struct imx_sc_rpc_msg hdr;
__le32 rate;
__le16 resource;
u8 clk;
} __packed __aligned(4);
struct req_get_clock_rate {
__le16 resource;
u8 clk;
} __packed __aligned(4);
struct resp_get_clock_rate {
__le32 rate;
};
/*
* struct imx_sc_msg_get_clock_rate - clock get rate protocol
* @hdr: SCU protocol header
* @req: get rate request protocol
* @resp: get rate response protocol
*
* This structure describes the SCU protocol of clock rate get
*/
struct imx_sc_msg_get_clock_rate {
struct imx_sc_rpc_msg hdr;
union {
struct req_get_clock_rate req;
struct resp_get_clock_rate resp;
} data;
};
/*
* struct imx_sc_msg_get_clock_parent - clock get parent protocol
Annotation
- Immediate include surface: `dt-bindings/firmware/imx/rsrc.h`, `linux/arm-smccc.h`, `linux/bsearch.h`, `linux/clk-provider.h`, `linux/err.h`, `linux/of.h`, `linux/firmware/imx/svc/rm.h`, `linux/platform_device.h`.
- Detected declarations: `struct imx_scu_clk_node`, `struct clk_scu`, `struct clk_gpr_scu`, `struct imx_sc_msg_req_set_clock_rate`, `struct req_get_clock_rate`, `struct resp_get_clock_rate`, `struct imx_sc_msg_get_clock_rate`, `struct imx_sc_msg_get_clock_parent`, `struct req_get_clock_parent`, `struct resp_get_clock_parent`.
- Atlas domain: Driver Families / drivers/clk.
- Implementation status: integration 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.