clk: add a fixed factor clock
Having fixed factors/dividers in hardware is a common pattern, so add a basic clock type doing this. It basically describes a fixed factor clock using a nominator and a denominator. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Viresh Kumar <viresh.kumar@st.com> Tested-by: Shawn Guo <shawn.guo@linaro.org> [mturquette@linaro.org: constify parent_names in static init macro] [mturquette@linaro.org: copy/paste bug from mux in static init macro] [mturquette@linaro.org: fix error handling in clk_register_fixed_factor] [mturquette@linaro.org: improve division accuracy; thanks to Saravana] Signed-off-by: Mike Turquette <mturquette@linaro.org>
This commit is contained in:
committed by
Mike Turquette
parent
31df9db995
commit
f0948f59db
@@ -276,6 +276,29 @@ struct clk *clk_register_mux(struct device *dev, const char *name,
|
||||
void __iomem *reg, u8 shift, u8 width,
|
||||
u8 clk_mux_flags, spinlock_t *lock);
|
||||
|
||||
/**
|
||||
* struct clk_fixed_factor - fixed multiplier and divider clock
|
||||
*
|
||||
* @hw: handle between common and hardware-specific interfaces
|
||||
* @mult: multiplier
|
||||
* @div: divider
|
||||
*
|
||||
* Clock with a fixed multiplier and divider. The output frequency is the
|
||||
* parent clock rate divided by div and multiplied by mult.
|
||||
* Implements .recalc_rate, .set_rate and .round_rate
|
||||
*/
|
||||
|
||||
struct clk_fixed_factor {
|
||||
struct clk_hw hw;
|
||||
unsigned int mult;
|
||||
unsigned int div;
|
||||
};
|
||||
|
||||
extern struct clk_ops clk_fixed_factor_ops;
|
||||
struct clk *clk_register_fixed_factor(struct device *dev, const char *name,
|
||||
const char *parent_name, unsigned long flags,
|
||||
unsigned int mult, unsigned int div);
|
||||
|
||||
/**
|
||||
* clk_register - allocate a new clock, register it and return an opaque cookie
|
||||
* @dev: device that is registering this clock
|
||||
|
||||
Reference in New Issue
Block a user