Caleb Connolly | d2e24c1 | 2025-02-10 16:27:25 +0000 | [diff] [blame] | 1 | // 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 */ |
| 14 | static 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 | |
| 21 | U_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 | |
| 29 | static ulong stub_clk_set_rate(struct clk *clk, ulong rate) |
| 30 | { |
| 31 | return (clk->rate = rate); |
| 32 | } |
| 33 | |
| 34 | static ulong stub_clk_get_rate(struct clk *clk) |
| 35 | { |
| 36 | return clk->rate; |
| 37 | } |
| 38 | |
| 39 | static int stub_clk_nop(struct clk *clk) |
| 40 | { |
| 41 | return 0; |
| 42 | } |
| 43 | |
| 44 | static 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 | |
| 51 | static const struct udevice_id stub_clk_ids[] = { |
| 52 | { .compatible = "qcom,rpmcc" }, |
Julius Lehmann | 6f1ea25 | 2025-02-10 16:27:27 +0000 | [diff] [blame] | 53 | { .compatible = "qcom,sm8150-rpmh-clk" }, |
Caleb Connolly | d2e24c1 | 2025-02-10 16:27:25 +0000 | [diff] [blame] | 54 | { .compatible = "qcom,sm8250-rpmh-clk" }, |
| 55 | { .compatible = "qcom,sm8550-rpmh-clk" }, |
| 56 | { .compatible = "qcom,sm8650-rpmh-clk" }, |
| 57 | { } |
| 58 | }; |
| 59 | |
| 60 | U_BOOT_DRIVER(clk_stub) = { |
| 61 | .name = "clk_stub", |
| 62 | .id = UCLASS_CLK, |
| 63 | .ops = &stub_clk_ops, |
| 64 | .of_match = stub_clk_ids, |
| 65 | .flags = DM_FLAG_DEFAULT_PD_CTRL_OFF, |
| 66 | }; |
| 67 | |