可以使用clk_register_mux()函数注册一个时钟选择器,在使用时可以通过clk_set_parent()函数设置该时钟的父时钟。 Divider Clock(时钟分频器):将输入时钟的频率分频后得到输出时钟。可以使用clk_register_divider()函数注册一个时钟分频器,在使用时可以通过clk_set_rate()函数设置该时钟的频率。 Fractional-N PLL Clo...
long clk_round_rate(struct clk *clk, unsigned long rate) //获取时钟频率 unsigned long clk_get_rate(struct clk *clk) //设置时钟频率 int clk_set_rate(struct clk *clk, unsigned long rate) 准备/使能clk: /* 开时钟前调用,可能会造成休眠,所以把休眠部分放到这里,可以原子操作的放到enable里 */ ...
if(clk_hw_get_flags(hw)&CLK_SET_RATE_PARENT) { unsignedlongbest_parent; best_parent=(rate/fix->mult)*fix->div; *prate=clk_hw_round_rate(clk_hw_get_parent(hw),best_parent); } return(*prate/fix->div)*fix->mult; } staticintclk_factor_set_rate(structclk_hw*hw,unsignedlongrate, ...
u8 clk_gate_flags, spinlock_t *lock); 3.divider clock 这一类clock可以设置分频值(因而会提供.recalc_rate/.set_rate/.round_rate回调),可通过下面两个接口注册: struct clk *clk_register_divider(struct device *dev, const char *name, const char *parent_name, unsigned long flags, void __iomem ...
int (*set_parent)(struct clk_hw *hw, u8 index); u8 (*get_parent)(struct clk_hw *hw); int (*set_rate)(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate); int (*set_rate_and_parent)(struct clk_hw *hw,
.gate_bit = (1<<1), }; struct clk_data 这个结构体,用来保存clk节点的寄存器以及相关的bit信息的。 这些成员变量在clk_set_rate、clk_enable、clk_ disable等api中被使用的。比 较重要的,有如下成员变量: clk_ctrl_reg gate_bit bypass_bit clk_status_reg clk_sw_rst_reg clk_cfg_reg div_max div...
/* parents need enable during gate/ungate, set rate and re-parent */ #define CLK_OPS_PARENT_ENABLE BIT(12) /* duty cycle call may be forwarded to the parent clock */ #define CLK_DUTY_CYCLE_PARENT BIT(13) struct clk; struct clk_hw; @@ -66,6 +68,17 @@ struct clk_rate_request...
return clk_register_gate(NULL, name, parent, CLK_SET_RATE_PARENT, reg, bit_idx, clk_gate_flags, NULL); } struct clk *sandbox_clk_register_gate2(struct device *dev, const char *name, const char *parent_name, unsigned long flags,8...
3.3.5.clk_get_parent9 3.3.6.clk_prepare9 3.3.7.clk_enable10 3.3.8.clk_prepare_enable10 3.3.9.clk_disable11 3.3.10.clk_unprepare11 3.3.11.clk_disable_unprepare11 3.3.12.clk_get_rate12 3.3.13.clk_set_rate12 3.3.14.sunxi_periph_reset_assert12 3.3.15.sunxi_periph_reset_deassert12 ...
/*** DOC: basic gatable clock which can gate and ungate its output** Traits of this clock:* prepare - clk_(un)prepare only ensures parent is (un)prepared* enable - clk_enable and clk_disable are functional & control gating* rate - inherits rate from parent. No clk_set_rate support...