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
parent
b473c6d5a3
commit
9cc49e69d8
|
@ -27,6 +27,12 @@ Required properties for GPIO node:
|
||||||
Note: Each GPIO port should have an alias correctly numbered in "aliases"
|
Note: Each GPIO port should have an alias correctly numbered in "aliases"
|
||||||
node.
|
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:
|
Examples:
|
||||||
|
|
||||||
aliases {
|
aliases {
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/bitops.h>
|
#include <linux/bitops.h>
|
||||||
|
#include <linux/clk.h>
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
#include <linux/gpio.h>
|
#include <linux/gpio.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
|
@ -258,6 +259,7 @@ static int vf610_gpio_probe(struct platform_device *pdev)
|
||||||
&pdev->dev);
|
&pdev->dev);
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
struct device_node *np = dev->of_node;
|
struct device_node *np = dev->of_node;
|
||||||
|
struct clk *clk_port, *clk_gpio;
|
||||||
struct vf610_gpio_port *port;
|
struct vf610_gpio_port *port;
|
||||||
struct resource *iores;
|
struct resource *iores;
|
||||||
struct gpio_chip *gc;
|
struct gpio_chip *gc;
|
||||||
|
@ -282,6 +284,23 @@ static int vf610_gpio_probe(struct platform_device *pdev)
|
||||||
if (port->irq < 0)
|
if (port->irq < 0)
|
||||||
return port->irq;
|
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 = &port->gc;
|
||||||
gc->of_node = np;
|
gc->of_node = np;
|
||||||
gc->parent = dev;
|
gc->parent = dev;
|
||||||
|
|
Loading…
Reference in New Issue