
+Stephen
Hi Benjamin,
On 20 June 2016 at 12:26, Benjamin Tietz uboot@dresden.micronet24.de wrote:
From: Benjamin Tietz benjamin@micronet24.de
Currently, clocks can be enabled, only. To be feature-complete - and allow a bit of power-saving in applications - disabling a clock should be possible, too.
This extend the API of the DM clock driver to allow a clock to be disabled.
The corresponding operation is optional for not breaking existing drivers.
What does this mean? I can't see how it is optional.
Also please can you rebase to mainline and resend, as the API has changed (sorry).
drivers/clk/clk-uclass.c | 10 ++++++++++ include/clk.h | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+)
diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index b483c1e..462f5f8 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -44,6 +44,16 @@ int clk_enable(struct udevice *dev, int periph) return ops->enable(dev, periph); }
+int clk_disable(struct udevice *dev, int periph) +{
struct clk_ops *ops = clk_get_ops(dev);
if (!ops->disable)
return -ENOSYS;
return ops->disable(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 ca20c3d..395f813 100644 --- a/include/clk.h +++ b/include/clk.h @@ -43,6 +43,15 @@ struct clk_ops { int (*enable)(struct udevice *dev, int periph);
/**
* disable() - Disable the clock for a peripheral
*
* @dev: clock provider
* @periph: Peripheral ID to enable
disable
* @return zero on success, or -ve error code
*/
int (*disable)(struct udevice *dev, int periph);
/** * get_periph_rate() - Get clock rate for a peripheral * * @dev: Device to check (UCLASS_CLK)
@@ -90,6 +99,15 @@ ulong clk_set_rate(struct udevice *dev, ulong rate); int clk_enable(struct udevice *dev, int periph);
/**
- clk_disable() - Disable the clock for a peripheral
- @dev: clock provider
- @periph: Peripheral ID to enable
- @return zero on success, or -ve error code
- */
+int clk_disable(struct udevice *dev, int periph);
+/**
- clk_get_periph_rate() - Get current clock rate for a peripheral
- @dev: Device to check (UCLASS_CLK)
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot