Go to the documentation of this file.
4 #include <linux/list.h>
7 #include <linux/types.h>
22 #ifdef CONFIG_SH_CLK_CPG_LEGACY
33 #define SH_CLK_DIV_MSK(div) ((1 << (div)) - 1)
34 #define SH_CLK_DIV4_MSK SH_CLK_DIV_MSK(4)
35 #define SH_CLK_DIV6_MSK SH_CLK_DIV_MSK(6)
66 #define CLK_ENABLE_ON_INIT BIT(0)
68 #define CLK_ENABLE_REG_32BIT BIT(1)
69 #define CLK_ENABLE_REG_16BIT BIT(2)
70 #define CLK_ENABLE_REG_8BIT BIT(3)
72 #define CLK_MASK_DIV_ON_DISABLE BIT(4)
74 #define CLK_ENABLE_REG_MASK (CLK_ENABLE_REG_32BIT | \
75 CLK_ENABLE_REG_16BIT | \
110 unsigned int div_max,
unsigned long rate);
113 unsigned int mult_max,
unsigned long rate);
116 unsigned long *best_freq,
unsigned long *parent_freq,
117 unsigned int div_min,
unsigned int div_max);
119 #define SH_CLK_MSTP(_parent, _enable_reg, _enable_bit, _flags) \
122 .enable_reg = (void __iomem *)_enable_reg, \
123 .enable_bit = _enable_bit, \
127 #define SH_CLK_MSTP32(_p, _r, _b, _f) \
128 SH_CLK_MSTP(_p, _r, _b, _f | CLK_ENABLE_REG_32BIT)
130 #define SH_CLK_MSTP16(_p, _r, _b, _f) \
131 SH_CLK_MSTP(_p, _r, _b, _f | CLK_ENABLE_REG_16BIT)
133 #define SH_CLK_MSTP8(_p, _r, _b, _f) \
134 SH_CLK_MSTP(_p, _r, _b, _f | CLK_ENABLE_REG_8BIT)
149 #define SH_CLK_DIV4(_parent, _reg, _shift, _div_bitmap, _flags) \
152 .enable_reg = (void __iomem *)_reg, \
153 .enable_bit = _shift, \
154 .arch_flags = _div_bitmap, \
155 .div_mask = SH_CLK_DIV4_MSK, \
164 #define clk_div4_table clk_div_table
173 #define SH_CLK_DIV6_EXT(_reg, _flags, _parents, \
174 _num_parents, _src_shift, _src_width) \
176 .enable_reg = (void __iomem *)_reg, \
178 .flags = _flags | CLK_MASK_DIV_ON_DISABLE, \
179 .div_mask = SH_CLK_DIV6_MSK, \
180 .parent_table = _parents, \
181 .parent_num = _num_parents, \
182 .src_shift = _src_shift, \
183 .src_width = _src_width, \
186 #define SH_CLK_DIV6(_parent, _reg, _flags) \
189 .enable_reg = (void __iomem *)_reg, \
191 .div_mask = SH_CLK_DIV6_MSK, \
192 .flags = _flags | CLK_MASK_DIV_ON_DISABLE, \
198 #define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
199 #define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk }
200 #define CLKDEV_ICK_ID(_cid, _did, _clk) { .con_id = _cid, .dev_id = _did, .clk = _clk }