clk: add gpio controlled clock multiplexer

Add a common clock driver for basic gpio controlled clock multiplexers.
This driver can be used for devices like 5V41068A or 831721I from IDT
or for discrete multiplexer circuits. The 'select' pin selects one of
two parent clocks.

Cc: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Sergej Sawazki <ce3a@gmx.de>
[sboyd@codeaurora.org: Fix error paths to free memory and do it
in the correct order]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
This commit is contained in:
Sergej Sawazki
2015-06-28 16:24:55 +02:00
committed by Stephen Boyd
parent 281cbb0076
commit 80eeb1f0f7
3 changed files with 237 additions and 87 deletions

View File

@@ -549,6 +549,23 @@ struct clk *clk_register_gpio_gate(struct device *dev, const char *name,
void of_gpio_clk_gate_setup(struct device_node *node);
/**
* struct clk_gpio_mux - gpio controlled clock multiplexer
*
* @hw: see struct clk_gpio
* @gpiod: gpio descriptor to select the parent of this clock multiplexer
*
* Clock with a gpio control for selecting the parent clock.
* Implements .get_parent, .set_parent and .determine_rate
*/
extern const struct clk_ops clk_gpio_mux_ops;
struct clk *clk_register_gpio_mux(struct device *dev, const char *name,
const char **parent_names, u8 num_parents, unsigned gpio,
bool active_low, unsigned long flags);
void of_gpio_mux_clk_setup(struct device_node *node);
/**
* clk_register - allocate a new clock, register it and return an opaque cookie
* @dev: device that is registering this clock