1
0
Fork 0

MLK-17491-14 gpio-vf610: add getting necessary clocks support

On MX7ULP, GPIO controller needs two necessary clocks:
Port module clock and GPIO module clock.

Add them as optional clocks to use.

Acked-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
pull/10/head
Dong Aisheng 2017-08-15 11:32:18 +08:00 committed by Jason Liu
parent b473c6d5a3
commit 9cc49e69d8
2 changed files with 25 additions and 0 deletions

View File

@ -27,6 +27,12 @@ Required properties for GPIO node:
Note: Each GPIO port should have an alias correctly numbered in "aliases"
node.
Optional properties:
- clocks : phandle + clock specifier pairs, one for each entry in
clock-names.
- clock-names : should contain: "port" - the Port module clock and
"gpio" - the GPIO module clock.
Examples:
aliases {

View File

@ -16,6 +16,7 @@
*/
#include <linux/bitops.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/gpio.h>
#include <linux/init.h>
@ -258,6 +259,7 @@ static int vf610_gpio_probe(struct platform_device *pdev)
&pdev->dev);
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
struct clk *clk_port, *clk_gpio;
struct vf610_gpio_port *port;
struct resource *iores;
struct gpio_chip *gc;
@ -282,6 +284,23 @@ static int vf610_gpio_probe(struct platform_device *pdev)
if (port->irq < 0)
return port->irq;
clk_port = devm_clk_get(&pdev->dev, "port");
clk_gpio = devm_clk_get(&pdev->dev, "gpio");
if (PTR_ERR(clk_port) == -EPROBE_DEFER ||
PTR_ERR(clk_gpio) == -EPROBE_DEFER)
return -EPROBE_DEFER;
if (!IS_ERR(clk_port) && !IS_ERR(clk_gpio)) {
ret = clk_prepare_enable(clk_port);
if (ret)
return ret;
ret = clk_prepare_enable(clk_gpio);
if (ret) {
clk_disable_unprepare(clk_port);
return ret;
}
}
gc = &port->gc;
gc->of_node = np;
gc->parent = dev;