blob: ea817031fa6c0cc1ea21000273b5651be5d05e65 [file] [log] [blame]
Caleb Connollyd2e24c12025-02-10 16:27:25 +00001// SPDX-License-Identifier: GPL-2.0
2/*
3 * Stub clk driver for non-essential clocks.
4 *
5 * This driver should be used for clock controllers
6 * which are described as dependencies in DT but aren't
7 * actually necessary for hardware functionality.
8 */
9
10#include <clk-uclass.h>
11#include <dm.h>
12
13/* NOP parent nodes to stub clocks */
14static const struct udevice_id nop_parent_ids[] = {
15 { .compatible = "qcom,rpm-proc" },
16 { .compatible = "qcom,glink-rpm" },
17 { .compatible = "qcom,rpm-sm6115" },
18 { }
19};
20
21U_BOOT_DRIVER(nop_parent) = {
22 .name = "nop_parent",
23 .id = UCLASS_NOP,
24 .of_match = nop_parent_ids,
25 .bind = dm_scan_fdt_dev,
26 .flags = DM_FLAG_DEFAULT_PD_CTRL_OFF,
27};
28
29static ulong stub_clk_set_rate(struct clk *clk, ulong rate)
30{
31 return (clk->rate = rate);
32}
33
34static ulong stub_clk_get_rate(struct clk *clk)
35{
36 return clk->rate;
37}
38
39static int stub_clk_nop(struct clk *clk)
40{
41 return 0;
42}
43
44static struct clk_ops stub_clk_ops = {
45 .set_rate = stub_clk_set_rate,
46 .get_rate = stub_clk_get_rate,
47 .enable = stub_clk_nop,
48 .disable = stub_clk_nop,
49};
50
51static const struct udevice_id stub_clk_ids[] = {
52 { .compatible = "qcom,rpmcc" },
53 { .compatible = "qcom,sm8250-rpmh-clk" },
54 { .compatible = "qcom,sm8550-rpmh-clk" },
55 { .compatible = "qcom,sm8650-rpmh-clk" },
56 { }
57};
58
59U_BOOT_DRIVER(clk_stub) = {
60 .name = "clk_stub",
61 .id = UCLASS_CLK,
62 .ops = &stub_clk_ops,
63 .of_match = stub_clk_ids,
64 .flags = DM_FLAG_DEFAULT_PD_CTRL_OFF,
65};
66