clk: Add parent round/set rate for mux and gate
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
b1cc0d7fc6
commit
1184234a5e
|
@ -77,6 +77,8 @@ static int clk_gate_is_enabled(struct clk *clk)
|
|||
}
|
||||
|
||||
static struct clk_ops clk_gate_ops = {
|
||||
.set_rate = clk_parent_set_rate,
|
||||
.round_rate = clk_parent_round_rate,
|
||||
.enable = clk_gate_enable,
|
||||
.disable = clk_gate_disable,
|
||||
.is_enabled = clk_gate_is_enabled,
|
||||
|
|
|
@ -51,6 +51,8 @@ static int clk_mux_set_parent(struct clk *clk, u8 idx)
|
|||
}
|
||||
|
||||
static struct clk_ops clk_mux_ops = {
|
||||
.set_rate = clk_parent_set_rate,
|
||||
.round_rate = clk_parent_round_rate,
|
||||
.get_parent = clk_mux_get_parent,
|
||||
.set_parent = clk_mux_set_parent,
|
||||
};
|
||||
|
|
|
@ -259,11 +259,31 @@ int clk_is_enabled(struct clk *clk)
|
|||
return clk_is_enabled(clk);
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic struct clk_ops callbacks
|
||||
*/
|
||||
int clk_is_enabled_always(struct clk *clk)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
long clk_parent_round_rate(struct clk *clk, unsigned long rate,
|
||||
unsigned long *prate)
|
||||
{
|
||||
if (!(clk->flags & CLK_SET_RATE_PARENT))
|
||||
return *prate;
|
||||
|
||||
return clk_round_rate(clk_get_parent(clk), rate);
|
||||
}
|
||||
|
||||
int clk_parent_set_rate(struct clk *clk, unsigned long rate,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
if (!(clk->flags & CLK_SET_RATE_PARENT))
|
||||
return 0;
|
||||
return clk_set_rate(clk_get_parent(clk), rate);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_OFTREE) && defined(CONFIG_COMMON_CLK_OF_PROVIDER)
|
||||
/**
|
||||
* struct of_clk_provider - Clock provider registration structure
|
||||
|
|
|
@ -276,6 +276,10 @@ struct clk *clk_gate_inverted(const char *name, const char *parent, void __iomem
|
|||
int clk_is_enabled(struct clk *clk);
|
||||
|
||||
int clk_is_enabled_always(struct clk *clk);
|
||||
long clk_parent_round_rate(struct clk *clk, unsigned long rate,
|
||||
unsigned long *prate);
|
||||
int clk_parent_set_rate(struct clk *clk, unsigned long rate,
|
||||
unsigned long parent_rate);
|
||||
|
||||
int clk_register(struct clk *clk);
|
||||
|
||||
|
|
Loading…
Reference in New Issue