1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * (C) Copyright 2020 - 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;
64 struct fixed_rate_data {
77 struct mux_pllctrl_data {
80 const char * const *parents;
92 struct hfosc_data hfosc;
93 struct postdiv_data postdiv;
94 struct mux_pllctrl_data mux_pllctrl;
95 struct fixed_rate_data fixed_rate;
99 #define CLK_MUX(_name, _parents, _num_parents, _reg, _shift, _width, _flags) \
101 .type = CLK_TYPE_MUX, \
102 .clk.mux = { .name = _name, .parents = _parents, \
104 .num_parents = _num_parents, .shift = _shift, \
105 .width = _width, .flags = _flags } \
108 #define CLK_DIV(_name, _parent, _reg, _shift, _width, _flags) \
110 .type = CLK_TYPE_DIV, \
111 .clk.div = {.name = _name, .parent = _parent, .reg = _reg, .shift = _shift, .width = _width, .flags = _flags } \
114 #define CLK_DIV_DEFFREQ(_name, _parent, _reg, _shift, _width, _flags, _freq) \
116 .type = CLK_TYPE_DIV, \
117 .default_freq = _freq, \
119 .name = _name, .parent = _parent, \
120 .reg = _reg, .shift = _shift, \
121 .width = _width, .flags = _flags } \
124 #define CLK_PLL(_name, _parent, _reg, _flags) \
126 .type = CLK_TYPE_PLL, \
127 .clk.pll = {.name = _name, .parent = _parent, .reg = _reg, .flags = _flags } \
130 #define CLK_PLL_DEFFREQ(_name, _parent, _reg, _flags, _freq) \
132 .type = CLK_TYPE_PLL, \
133 .default_freq = _freq, \
134 .clk.pll = { .name = _name, .parent = _parent, \
135 .reg = _reg, .flags = _flags } \
138 #define CLK_HFOSC(_name, _flags) \
140 .type = CLK_TYPE_HFOSC, \
141 .clk.hfosc = { .name = _name, .flags = _flags } \
144 #define CLK_FIXED_RATE(_name, _rate, _flags) \
146 .type = CLK_TYPE_FIXED_RATE, \
147 .clk.fixed_rate = { .name = _name, .rate = _rate, .flags = _flags } \
150 #define CLK_POSTDIV(_name, _parent, _width, _flags) \
152 .type = CLK_TYPE_POSTDIV, \
153 .clk.postdiv = {.name = _name, .parent = _parent, .width = _width, .flags = _flags } \
156 #define CLK_MUX_PLLCTRL(_name, _parents, _num_parents, _reg, _flags) \
158 .type = CLK_TYPE_MUX, \
159 .clk.mux_pllctrl = { .name = _name, .parents = _parents,\
160 .num_parents = _num_parents, .flags = _flags } \
163 struct ti_k3_clk_platdata {
164 const struct clk_data *clk_list;
166 const struct dev_clk *soc_dev_clk_data;
167 int soc_dev_clk_data_cnt;
170 extern const struct ti_k3_clk_platdata j721e_clk_platdata;
171 extern const struct ti_k3_clk_platdata j7200_clk_platdata;
173 struct clk *clk_register_ti_pll(const char *name, const char *parent_name,
176 #endif /* __K3_CLK_H__ */