From: stefan@agner.ch (Stefan Agner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V2 4/8] gpio: vf610: add optional clock support
Date: Thu, 25 Oct 2018 19:58:47 +0200 [thread overview]
Message-ID: <c023948f3baee96cb186f970fdb71ebd@agner.ch> (raw)
In-Reply-To: <1540295058-26090-5-git-send-email-aisheng.dong@nxp.com>
On 23.10.2018 13:49, A.s. Dong wrote:
> 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 at 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");
Are you sure that those are two independent clocks? On i.MX 7 usually
there was a single clock gate controlling multiple clocks at once (which
should be modeled as a single clock gate in the clock tree).
--
Stefan
> + 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;
next prev parent reply other threads:[~2018-10-25 17:58 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-23 11:48 [PATCH V2 0/8] ARM: imx: add imx7ulp support A.s. Dong
2018-10-23 11:49 ` [PATCH V2 1/8] dt-bindings: fsl: add compatible for imx7ulp evk A.s. Dong
2018-10-23 11:49 ` [PATCH V2 2/8] dt-bindings: fsl: add imx7ulp pm related components bindings A.s. Dong
2018-10-24 21:54 ` Rob Herring
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 ` [PATCH V2 4/8] gpio: vf610: add optional clock support A.s. Dong
2018-10-23 12:04 ` 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 [this message]
2018-10-26 3:49 ` A.s. Dong
2018-10-26 8:15 ` Stefan Agner
2018-10-30 15:34 ` A.s. Dong
2018-10-23 11:49 ` [PATCH V2 5/8] ARM: imx: add initial support for imx7ulp A.s. Dong
2018-10-23 11:49 ` [PATCH V2 6/8] dts: imx: add common imx7ulp dtsi support A.s. Dong
2018-10-24 22:02 ` Rob Herring
2018-10-25 11:53 ` A.s. Dong
2018-10-25 16:44 ` Fabio Estevam
2018-10-25 16:54 ` A.s. Dong
2018-10-23 11:49 ` [PATCH V2 7/8] dts: fsl: add imx7ulp evk support A.s. Dong
2018-10-23 12:28 ` Fabio Estevam
2018-10-23 14:42 ` A.s. Dong
2018-10-23 16:25 ` Fabio Estevam
2018-10-24 8:14 ` A.s. Dong
2018-10-25 11:36 ` A.s. Dong
2018-10-26 10:56 ` Sascha Hauer
2018-10-26 13:52 ` A.s. Dong
2018-10-23 11:49 ` [PATCH V2 8/8] ARM: imx_v6_v7_defconfig: add imx7ulp support 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=c023948f3baee96cb186f970fdb71ebd@agner.ch \
--to=stefan@agner.ch \
--cc=linux-arm-kernel@lists.infradead.org \
/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).