From: "A.s. Dong" <aisheng.dong@nxp.com>
To: "linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Cc: "A.s. Dong" <aisheng.dong@nxp.com>,
"dongas86@gmail.com" <dongas86@gmail.com>,
Linus Walleij <linus.walleij@linaro.org>,
"linux@armlinux.org.uk" <linux@armlinux.org.uk>,
Stefan Agner <stefan@agner.ch>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
"robh+dt@kernel.org" <robh+dt@kernel.org>,
dl-linux-imx <linux-imx@nxp.com>,
"kernel@pengutronix.de" <kernel@pengutronix.de>,
Fabio Estevam <fabio.estevam@nxp.com>,
"shawnguo@kernel.org" <shawnguo@kernel.org>
Subject: [PATCH V2 4/8] gpio: vf610: add optional clock support
Date: Tue, 23 Oct 2018 11:49:17 +0000 [thread overview]
Message-ID: <1540295058-26090-5-git-send-email-aisheng.dong@nxp.com> (raw)
In-Reply-To: <1540295058-26090-1-git-send-email-aisheng.dong@nxp.com>
Some SoCs need the gpio clock to be enabled before accessing
HW registers. This patch add the optional clock handling.
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Stefan Agner <stefan@agner.ch>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
v1->v2:
* new patch
---
drivers/gpio/gpio-vf610.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c
index d4ad6d0..cbc4f44 100644
--- a/drivers/gpio/gpio-vf610.c
+++ b/drivers/gpio/gpio-vf610.c
@@ -16,6 +16,7 @@
*/
#include <linux/bitops.h>
+#include <linux/clk.h>
#include <linux/err.h>
#include <linux/gpio.h>
#include <linux/init.h>
@@ -256,6 +257,7 @@ static int vf610_gpio_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
+ struct clk *clk_gpio, *clk_port;
struct vf610_gpio_port *port;
struct resource *iores;
struct gpio_chip *gc;
@@ -280,6 +282,24 @@ static int vf610_gpio_probe(struct platform_device *pdev)
if (port->irq < 0)
return port->irq;
+ clk_gpio = devm_clk_get(&pdev->dev, "gpio");
+ clk_port = devm_clk_get(&pdev->dev, "port");
+ if ((PTR_ERR(clk_gpio) == -EPROBE_DEFER) ||
+ (PTR_ERR(clk_port) == -EPROBE_DEFER)) {
+ return -EPROBE_DEFER;
+ } else if (!IS_ERR_OR_NULL(clk_gpio) &&
+ !IS_ERR_OR_NULL(clk_port)) {
+ ret = clk_prepare_enable(clk_gpio);
+ if (ret)
+ return ret;
+
+ ret = clk_prepare_enable(clk_port);
+ if (ret) {
+ clk_disable_unprepare(clk_gpio);
+ return ret;
+ }
+ }
+
gc = &port->gc;
gc->of_node = np;
gc->parent = dev;
--
2.7.4
next prev parent reply other threads:[~2018-10-23 11:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1540295058-26090-1-git-send-email-aisheng.dong@nxp.com>
2018-10-23 11:49 ` [PATCH V2 3/8] dt-bindings: gpio: vf610: add optional clocks property A.s. Dong
2018-10-24 21:55 ` Rob Herring
2018-10-23 11:49 ` A.s. Dong [this message]
2018-10-23 12:04 ` [PATCH V2 4/8] gpio: vf610: add optional clock support Russell King - ARM Linux
2018-10-23 12:23 ` A.s. Dong
2018-10-23 12:41 ` Uwe Kleine-König
2018-10-23 13:39 ` A.s. Dong
2018-10-25 17:58 ` Stefan Agner
2018-10-26 3:49 ` A.s. Dong
2018-10-26 8:15 ` Stefan Agner
2018-10-30 15:34 ` A.s. Dong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1540295058-26090-5-git-send-email-aisheng.dong@nxp.com \
--to=aisheng.dong@nxp.com \
--cc=dongas86@gmail.com \
--cc=fabio.estevam@nxp.com \
--cc=kernel@pengutronix.de \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=linux@armlinux.org.uk \
--cc=robh+dt@kernel.org \
--cc=shawnguo@kernel.org \
--cc=stefan@agner.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).