1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * (C) Copyright 2020-2021 Texas Instruments Incorporated - http://www.ti.com
4 * Tero Kristo <t-kristo@ti.com>
11 #include <linux/bitops.h>
12 #include <linux/clk-provider.h>
13 #include <linux/types.h>
22 #define DEV_CLK(_dev_id, _clk_id, _clk_name) { .dev_id = _dev_id, \
23 .clk_id = _clk_id, .clk_name = _clk_name, }
25 #define CLK_TYPE_MUX 0x01
26 #define CLK_TYPE_DIV 0x02
27 #define CLK_TYPE_PLL 0x03
28 #define CLK_TYPE_HFOSC 0x04
29 #define CLK_TYPE_POSTDIV 0x05
30 #define CLK_TYPE_MUX_PLLCTRL 0x06
31 #define CLK_TYPE_FIXED_RATE 0x07
43 const char * const *parents;
65 struct fixed_rate_data {
78 struct mux_pllctrl_data {
81 const char * const *parents;
93 struct hfosc_data hfosc;
94 struct postdiv_data postdiv;
95 struct mux_pllctrl_data mux_pllctrl;
96 struct fixed_rate_data fixed_rate;
100 #define CLK_MUX(_name, _parents, _num_parents, _reg, _shift, _width, _flags) \
102 .type = CLK_TYPE_MUX, \
103 .clk.mux = { .name = _name, .parents = _parents, \
105 .num_parents = _num_parents, .shift = _shift, \
106 .width = _width, .flags = _flags } \
109 #define CLK_DIV(_name, _parent, _reg, _shift, _width, _flags, _div_flags) \
111 .type = CLK_TYPE_DIV, \
113 .name = _name, .parent = _parent, .reg = _reg, \
114 .shift = _shift, .width = _width, \
115 .flags = _flags, .div_flags = _div_flags } \
118 #define CLK_DIV_DEFFREQ(_name, _parent, _reg, _shift, _width, _flags, _div_flags, _freq) \
120 .type = CLK_TYPE_DIV, \
121 .default_freq = _freq, \
123 .name = _name, .parent = _parent, .reg = _reg, \
124 .shift = _shift, .width = _width, \
125 .flags = _flags, .div_flags = _div_flags } \
128 #define CLK_PLL(_name, _parent, _reg, _flags) \
130 .type = CLK_TYPE_PLL, \
131 .clk.pll = {.name = _name, .parent = _parent, .reg = _reg, .flags = _flags } \
134 #define CLK_PLL_DEFFREQ(_name, _parent, _reg, _flags, _freq) \
136 .type = CLK_TYPE_PLL, \
137 .default_freq = _freq, \
138 .clk.pll = { .name = _name, .parent = _parent, \
139 .reg = _reg, .flags = _flags } \
142 #define CLK_HFOSC(_name, _flags) \
144 .type = CLK_TYPE_HFOSC, \
145 .clk.hfosc = { .name = _name, .flags = _flags } \
148 #define CLK_FIXED_RATE(_name, _rate, _flags) \
150 .type = CLK_TYPE_FIXED_RATE, \
151 .clk.fixed_rate = { .name = _name, .rate = _rate, .flags = _flags } \
154 #define CLK_POSTDIV(_name, _parent, _width, _flags) \
156 .type = CLK_TYPE_POSTDIV, \
157 .clk.postdiv = {.name = _name, .parent = _parent, .width = _width, .flags = _flags } \
160 #define CLK_MUX_PLLCTRL(_name, _parents, _num_parents, _reg, _flags) \
162 .type = CLK_TYPE_MUX, \
163 .clk.mux_pllctrl = { .name = _name, .parents = _parents,\
164 .num_parents = _num_parents, .flags = _flags } \
167 struct ti_k3_clk_platdata {
168 const struct clk_data *clk_list;
170 const struct dev_clk *soc_dev_clk_data;
171 int soc_dev_clk_data_cnt;
174 extern const struct ti_k3_clk_platdata j721e_clk_platdata;
175 extern const struct ti_k3_clk_platdata j7200_clk_platdata;
177 struct clk *clk_register_ti_pll(const char *name, const char *parent_name,
180 #endif /* __K3_CLK_H__ */