blob: 5f5aca41d5b322537f070a740bf1f80531006036 [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" },
Jorge Ramirez-Ortiz14e50952025-04-07 19:56:16 +020017 { .compatible = "qcom,glink-smd-rpm" },
Caleb Connollyd2e24c12025-02-10 16:27:25 +000018 { }
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" },
Caleb Connollyabbb3962025-03-24 19:17:37 +010053 { .compatible = "qcom,sdm845-rpmh-clk" },
Caleb Connolly398c5792025-03-17 15:54:36 +000054 { .compatible = "qcom,sc7280-rpmh-clk" },
Julius Lehmann6f1ea252025-02-10 16:27:27 +000055 { .compatible = "qcom,sm8150-rpmh-clk" },
Caleb Connollyd2e24c12025-02-10 16:27:25 +000056 { .compatible = "qcom,sm8250-rpmh-clk" },
57 { .compatible = "qcom,sm8550-rpmh-clk" },
58 { .compatible = "qcom,sm8650-rpmh-clk" },
59 { }
60};
61
62U_BOOT_DRIVER(clk_stub) = {
63 .name = "clk_stub",
64 .id = UCLASS_CLK,
65 .ops = &stub_clk_ops,
66 .of_match = stub_clk_ids,
67 .flags = DM_FLAG_DEFAULT_PD_CTRL_OFF,
68};
69