[U-Boot] [PATCH v4 3/3] gpio: at91_gpio: add the clock support

Wenyou Yang wenyou.yang at atmel.com
Thu Mar 23 04:46:21 UTC 2017


Add the clock support.

Signed-off-by: Wenyou Yang <wenyou.yang at atmel.com>
Reviewed-by: Simon Glass <sjg at chromium.org>
Reviewed-by: Andreas Bießmann <andreas at biessmann.org>
---

Changes in v4:
 - Rebase on v2017.03.

Changes in v3:
 - Rebase on the master branch on git://git.denx.de/u-boot-atmel.git
   commit: 0ff27d4a94637d4b1937c625d33212375bd118d9
 - Add Reviewed-by tag.

Changes in v2:
 - Add Reviewed-by tag.

 drivers/gpio/at91_gpio.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/gpio/at91_gpio.c b/drivers/gpio/at91_gpio.c
index 23b2dc3b9b..bd5c8c4d69 100644
--- a/drivers/gpio/at91_gpio.c
+++ b/drivers/gpio/at91_gpio.c
@@ -10,6 +10,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <clk.h>
 #include <dm.h>
 #include <asm/io.h>
 #include <linux/sizes.h>
@@ -517,6 +518,18 @@ static int at91_gpio_probe(struct udevice *dev)
 	struct at91_port_priv *port = dev_get_priv(dev);
 	struct at91_port_platdata *plat = dev_get_platdata(dev);
 	struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
+	struct clk clk;
+	int ret;
+
+	ret = clk_get_by_index(dev, 0, &clk);
+	if (ret)
+		return ret;
+
+	ret = clk_enable(&clk);
+	if (ret)
+		return ret;
+
+	clk_free(&clk);
 
 	uc_priv->bank_name = plat->bank_name;
 	uc_priv->gpio_count = GPIO_PER_BANK;
-- 
2.11.0



More information about the U-Boot mailing list