[U-Boot] [PATCH07/23] driver: clock: allow disabling a peripheral clock
Benjamin Tietz
uboot at dresden.micronet24.de
Sat Jun 18 14:56:01 CEST 2016
From: Benjamin Tietz <benjamin at micronet24.de>
---
drivers/clk/clk-uclass.c | 10 ++++++++++
include/clk.h | 18 ++++++++++++++++++
2 files changed, 28 insertions(+)
-------------- next part --------------
From: Benjamin Tietz <benjamin at micronet24.de>
---
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
+ * @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)
More information about the U-Boot
mailing list