drivers/clk/imx/clk-imx6q.c
Source file repositories/reference/linux-study-clean/drivers/clk/imx/clk-imx6q.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/imx/clk-imx6q.c- Extension
.c- Size
- 59937 bytes
- Lines
- 1002
- 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/init.hlinux/types.hlinux/bits.hlinux/clk.hlinux/clkdev.hlinux/clk-provider.hlinux/err.hlinux/io.hlinux/mfd/syscon/imx6q-iomuxc-gpr.hlinux/of.hlinux/of_address.hlinux/of_irq.hsoc/imx/revision.hdt-bindings/clock/imx6qdl-clock.hclk.h
Detected Declarations
function clk_on_imx6qfunction clk_on_imx6qpfunction clk_on_imx6dlfunction ldb_di_sel_by_clock_idfunction of_assigned_ldb_selsfunction pll6_bypassedfunction mmdc_ch1_disablefunction mmdc_ch1_reenablefunction init_ldb_clksfunction disable_anatop_clocksfunction imx6q_obtain_fixed_clk_hwfunction imx6q_clocks_init
Annotated Snippet
if (rc < 0) {
/* skip empty (null) phandles */
if (rc == -ENOENT)
continue;
else
return;
}
if (clkspec.np != node || clkspec.args[0] >= IMX6QDL_CLK_END) {
pr_err("ccm: parent clock %d not in ccm\n", index);
of_node_put(clkspec.np);
return;
}
parent = clkspec.args[0];
of_node_put(clkspec.np);
rc = of_parse_phandle_with_args(node, "assigned-clocks",
"#clock-cells", index, &clkspec);
if (rc < 0)
return;
if (clkspec.np != node || clkspec.args[0] >= IMX6QDL_CLK_END) {
pr_err("ccm: child clock %d not in ccm\n", index);
of_node_put(clkspec.np);
return;
}
child = clkspec.args[0];
of_node_put(clkspec.np);
if (child != IMX6QDL_CLK_LDB_DI0_SEL &&
child != IMX6QDL_CLK_LDB_DI1_SEL)
continue;
sel = ldb_di_sel_by_clock_id(parent);
if (sel < 0) {
pr_err("ccm: invalid ldb_di%d parent clock: %d\n",
child == IMX6QDL_CLK_LDB_DI1_SEL, parent);
continue;
}
if (child == IMX6QDL_CLK_LDB_DI0_SEL)
*ldb_di0_sel = sel;
if (child == IMX6QDL_CLK_LDB_DI1_SEL)
*ldb_di1_sel = sel;
}
}
static bool pll6_bypassed(struct device_node *node)
{
int index, ret, num_clocks;
struct of_phandle_args clkspec;
num_clocks = of_count_phandle_with_args(node, "assigned-clocks",
"#clock-cells");
if (num_clocks < 0)
return false;
for (index = 0; index < num_clocks; index++) {
ret = of_parse_phandle_with_args(node, "assigned-clocks",
"#clock-cells", index,
&clkspec);
if (ret < 0)
return false;
if (clkspec.np == node &&
clkspec.args[0] == IMX6QDL_PLL6_BYPASS) {
of_node_put(clkspec.np);
break;
}
of_node_put(clkspec.np);
}
/* PLL6 bypass is not part of the assigned clock list */
if (index == num_clocks)
return false;
ret = of_parse_phandle_with_args(node, "assigned-clock-parents",
"#clock-cells", index, &clkspec);
if (!ret)
of_node_put(clkspec.np);
if (clkspec.args[0] != IMX6QDL_CLK_PLL6)
return true;
return false;
}
#define CCM_CCSR 0x0c
#define CCM_CS2CDR 0x2c
#define CCSR_PLL3_SW_CLK_SEL BIT(0)
Annotation
- Immediate include surface: `linux/init.h`, `linux/types.h`, `linux/bits.h`, `linux/clk.h`, `linux/clkdev.h`, `linux/clk-provider.h`, `linux/err.h`, `linux/io.h`.
- Detected declarations: `function clk_on_imx6q`, `function clk_on_imx6qp`, `function clk_on_imx6dl`, `function ldb_di_sel_by_clock_id`, `function of_assigned_ldb_sels`, `function pll6_bypassed`, `function mmdc_ch1_disable`, `function mmdc_ch1_reenable`, `function init_ldb_clks`, `function disable_anatop_clocks`.
- 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.