clk: add API to enable clock
The most basic thing for clock is to enable it, but it is missing in this uclass. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
9e52126f34
commit
f0e075162f
|
|
@ -32,6 +32,16 @@ ulong clk_set_rate(struct udevice *dev, ulong rate)
|
||||||
return ops->set_rate(dev, rate);
|
return ops->set_rate(dev, rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int clk_enable(struct udevice *dev, int periph)
|
||||||
|
{
|
||||||
|
struct clk_ops *ops = clk_get_ops(dev);
|
||||||
|
|
||||||
|
if (!ops->enable)
|
||||||
|
return -ENOSYS;
|
||||||
|
|
||||||
|
return ops->enable(dev, periph);
|
||||||
|
}
|
||||||
|
|
||||||
ulong clk_get_periph_rate(struct udevice *dev, int periph)
|
ulong clk_get_periph_rate(struct udevice *dev, int periph)
|
||||||
{
|
{
|
||||||
struct clk_ops *ops = clk_get_ops(dev);
|
struct clk_ops *ops = clk_get_ops(dev);
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,15 @@ struct clk_ops {
|
||||||
*/
|
*/
|
||||||
ulong (*set_rate)(struct udevice *dev, ulong rate);
|
ulong (*set_rate)(struct udevice *dev, ulong rate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* enable() - Enable the clock for a peripheral
|
||||||
|
*
|
||||||
|
* @dev: clock provider
|
||||||
|
* @periph: Peripheral ID to enable
|
||||||
|
* @return zero on success, or -ve error code
|
||||||
|
*/
|
||||||
|
int (*enable)(struct udevice *dev, int periph);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get_periph_rate() - Get clock rate for a peripheral
|
* get_periph_rate() - Get clock rate for a peripheral
|
||||||
*
|
*
|
||||||
|
|
@ -70,6 +79,15 @@ ulong clk_get_rate(struct udevice *dev);
|
||||||
*/
|
*/
|
||||||
ulong clk_set_rate(struct udevice *dev, ulong rate);
|
ulong clk_set_rate(struct udevice *dev, ulong rate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clk_enable() - Enable the clock for a peripheral
|
||||||
|
*
|
||||||
|
* @dev: clock provider
|
||||||
|
* @periph: Peripheral ID to enable
|
||||||
|
* @return zero on success, or -ve error code
|
||||||
|
*/
|
||||||
|
int clk_enable(struct udevice *dev, int periph);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clk_get_periph_rate() - Get current clock rate for a peripheral
|
* clk_get_periph_rate() - Get current clock rate for a peripheral
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue