1 /* 2 * Copyright 2020-2024 NXP 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 #include <s32cc-clk-ids.h> 7 #include <s32cc-clk-modules.h> 8 #include <s32cc-clk-utils.h> 9 10 /* Oscillators */ 11 static struct s32cc_osc fxosc = 12 S32CC_OSC_INIT(S32CC_FXOSC); 13 static struct s32cc_clk fxosc_clk = 14 S32CC_MODULE_CLK(fxosc); 15 16 static struct s32cc_osc firc = 17 S32CC_OSC_INIT(S32CC_FIRC); 18 static struct s32cc_clk firc_clk = 19 S32CC_MODULE_CLK(firc); 20 21 static struct s32cc_osc sirc = 22 S32CC_OSC_INIT(S32CC_SIRC); 23 static struct s32cc_clk sirc_clk = 24 S32CC_MODULE_CLK(sirc); 25 26 static struct s32cc_clk *s32cc_hw_clk_list[3] = { 27 /* Oscillators */ 28 [S32CC_CLK_ID(S32CC_CLK_FIRC)] = &firc_clk, 29 [S32CC_CLK_ID(S32CC_CLK_SIRC)] = &sirc_clk, 30 [S32CC_CLK_ID(S32CC_CLK_FXOSC)] = &fxosc_clk, 31 }; 32 33 static struct s32cc_clk_array s32cc_hw_clocks = { 34 .type_mask = S32CC_CLK_TYPE(S32CC_CLK_FIRC), 35 .clks = &s32cc_hw_clk_list[0], 36 .n_clks = ARRAY_SIZE(s32cc_hw_clk_list), 37 }; 38 39 struct s32cc_clk *s32cc_get_arch_clk(unsigned long id) 40 { 41 static const struct s32cc_clk_array *clk_table[1] = { 42 &s32cc_hw_clocks, 43 }; 44 45 return s32cc_get_clk_from_table(clk_table, ARRAY_SIZE(clk_table), id); 46 } 47