mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 20:54:03 +02:00
clk: sunxi-ng: div: add read-only operation support
Add support for sunxi-ng read-only dividers. This will be useful to the a733 oscillator detection logic. Reviewed-by: Chen-Yu Tsai <wens@kernel.org> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Link: https://patch.msgid.link/20260723-a733-rtc-v7-2-8fd68aab94ae@baylibre.com Signed-off-by: Chen-Yu Tsai <wens@kernel.org>
This commit is contained in:
parent
4bcba49984
commit
7bbbfcd4e4
|
|
@ -20,8 +20,22 @@ static int ccu_div_determine_rate_helper(struct ccu_mux_internal *mux,
|
|||
if (cd->common.features & CCU_FEATURE_FIXED_POSTDIV)
|
||||
req->rate *= cd->fixed_post_div;
|
||||
|
||||
ret = divider_determine_rate(&cd->common.hw, req, cd->div.table,
|
||||
cd->div.width, cd->div.flags);
|
||||
if (cd->div.flags & CLK_DIVIDER_READ_ONLY) {
|
||||
unsigned long val;
|
||||
u32 reg;
|
||||
|
||||
reg = readl(cd->common.base + cd->common.reg);
|
||||
val = reg >> cd->div.shift;
|
||||
val &= (1 << cd->div.width) - 1;
|
||||
|
||||
ret = divider_ro_determine_rate(&cd->common.hw, req, cd->div.table,
|
||||
cd->div.width, cd->div.flags, val);
|
||||
|
||||
} else {
|
||||
ret = divider_determine_rate(&cd->common.hw, req, cd->div.table,
|
||||
cd->div.width, cd->div.flags);
|
||||
}
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
@ -143,3 +157,16 @@ const struct clk_ops ccu_div_ops = {
|
|||
.set_rate = ccu_div_set_rate,
|
||||
};
|
||||
EXPORT_SYMBOL_NS_GPL(ccu_div_ops, "SUNXI_CCU");
|
||||
|
||||
const struct clk_ops ccu_rodiv_ops = {
|
||||
.disable = ccu_div_disable,
|
||||
.enable = ccu_div_enable,
|
||||
.is_enabled = ccu_div_is_enabled,
|
||||
|
||||
.get_parent = ccu_div_get_parent,
|
||||
.set_parent = ccu_div_set_parent,
|
||||
|
||||
.determine_rate = ccu_div_determine_rate,
|
||||
.recalc_rate = ccu_div_recalc_rate,
|
||||
};
|
||||
EXPORT_SYMBOL_NS_GPL(ccu_rodiv_ops, "SUNXI_CCU");
|
||||
|
|
|
|||
|
|
@ -300,5 +300,6 @@ static inline struct ccu_div *hw_to_ccu_div(struct clk_hw *hw)
|
|||
}
|
||||
|
||||
extern const struct clk_ops ccu_div_ops;
|
||||
extern const struct clk_ops ccu_rodiv_ops;
|
||||
|
||||
#endif /* _CCU_DIV_H_ */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user