blob: 343fa5cd3fe1704c6bb15a8c9852b9b4e4990351 [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" },
Caleb Connolly398c5792025-03-17 15:54:36 +000053 { .compatible = "qcom,sc7280-rpmh-clk" },
Julius Lehmann6f1ea252025-02-10 16:27:27 +000054 { .compatible = "qcom,sm8150-rpmh-clk" },
Caleb Connollyd2e24c12025-02-10 16:27:25 +000055 { .compatible = "qcom,sm8250-rpmh-clk" },
56 { .compatible = "qcom,sm8550-rpmh-clk" },
57 { .compatible = "qcom,sm8650-rpmh-clk" },
58 { }
59};
60
61U_BOOT_DRIVER(clk_stub) = {
62 .name = "clk_stub",
63 .id = UCLASS_CLK,
64 .ops = &stub_clk_ops,
65 .of_match = stub_clk_ids,
66 .flags = DM_FLAG_DEFAULT_PD_CTRL_OFF,
67};
68