diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2016-01-13 13:16:12 +0900 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2016-01-20 19:06:23 -0700 |
commit | f0e075162f815f9cb769c7bb9003e0ad3b829811 (patch) | |
tree | 77a9e9f87b2ddee05d6501c570f665dbdcc69924 | |
parent | 9e52126f347c1de39f8fe2c62d6486cf77f4af3a (diff) | |
download | u-boot-imx-f0e075162f815f9cb769c7bb9003e0ad3b829811.zip u-boot-imx-f0e075162f815f9cb769c7bb9003e0ad3b829811.tar.gz u-boot-imx-f0e075162f815f9cb769c7bb9003e0ad3b829811.tar.bz2 |
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>
-rw-r--r-- | drivers/clk/clk-uclass.c | 10 | ||||
-rw-r--r-- | include/clk.h | 18 |
2 files changed, 28 insertions, 0 deletions
diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index 73dfd7d..19f6f07 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -32,6 +32,16 @@ ulong clk_set_rate(struct udevice *dev, ulong 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) { struct clk_ops *ops = clk_get_ops(dev); diff --git a/include/clk.h b/include/clk.h index 371784a..941808a 100644 --- a/include/clk.h +++ b/include/clk.h @@ -33,6 +33,15 @@ struct clk_ops { 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 * * @dev: Device to check (UCLASS_CLK) @@ -71,6 +80,15 @@ ulong clk_get_rate(struct udevice *dev); 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 * * @dev: Device to check (UCLASS_CLK) |