xref: /rk3399_ARM-atf/drivers/ti/clk/ti_clk_fixed.c (revision a28114d66a6d43db4accef5fd5d6dab6c059e584)
1 /*
2  * Copyright (c) 2025-2026 Texas Instruments Incorporated - https://www.ti.com
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 /*
8  * TI Fixed Clock Driver
9  *
10  * This driver implements fixed-frequency clocks that cannot be modified.
11  * Fixed clocks are always enabled and return their configured frequency
12  * from the clock range data. These are typically used for board-level
13  * reference clocks and other unchangeable clock sources.
14  */
15 
16 #include <cdefs.h>
17 #include <ti_clk_fixed.h>
18 
ti_clk_fixed_get_freq(struct ti_clk * clkp)19 static uint32_t ti_clk_fixed_get_freq(struct ti_clk *clkp)
20 {
21 	const struct ti_clk_range *range;
22 
23 	range = ti_clk_get_range(clkp->range_idx);
24 	if (range == NULL) {
25 		return 0U;
26 	}
27 
28 	return range->min_hz;
29 }
30 
ti_clk_fixed_get_state(struct ti_clk * clkp __unused)31 static uint32_t ti_clk_fixed_get_state(struct ti_clk *clkp __unused)
32 {
33 	return TI_CLK_HW_STATE_ENABLED;
34 }
35 
36 const struct ti_clk_drv ti_clk_drv_fixed = {
37 	.get_freq = ti_clk_fixed_get_freq,
38 	.get_state = ti_clk_fixed_get_state,
39 };
40