aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWenyou Yang <wenyou.yang@atmel.com>2017-03-23 12:46:21 +0800
committerSimon Glass <sjg@chromium.org>2017-04-13 14:44:50 -0600
commitf2f3c1576a5d4b15788843ab3353e6307fe380ba (patch)
treed3c0abe5b13e53854c0a8c9cab76ebb49694d203
parentcf468880c37be1a7fea0a842a14ba1e1e388147c (diff)
downloadu-boot-f2f3c1576a5d4b15788843ab3353e6307fe380ba.zip
u-boot-f2f3c1576a5d4b15788843ab3353e6307fe380ba.tar.gz
u-boot-f2f3c1576a5d4b15788843ab3353e6307fe380ba.tar.bz2
gpio: at91_gpio: add the clock support
Add the clock support. Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Andreas Bießmann <andreas@biessmann.org>
-rw-r--r--drivers/gpio/at91_gpio.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/gpio/at91_gpio.c b/drivers/gpio/at91_gpio.c
index 37955cc..98dbd82 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>
@@ -569,6 +570,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;