From: David Daney <ddaney.cavm@gmail.com>
To: Grant Likely <grant.likely@linaro.org>,
Rob Herring <robh+dt@kernel.org>,
devicetree@vger.kernel.org,
Linus Walleij <linus.walleij@linaro.org>,
Alexandre Courbot <gnurou@gmail.com>,
linux-gpio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, David Daney <david.daney@cavium.com>
Subject: [PATCH v2 1/2] of/gpio: Define OF_GPIO_OPEN_DRAIN and OF_GPIO_OPEN_SOURCE flags.
Date: Tue, 11 Feb 2014 11:49:59 -0800 [thread overview]
Message-ID: <1392148200-5393-2-git-send-email-ddaney.cavm@gmail.com> (raw)
In-Reply-To: <1392148200-5393-1-git-send-email-ddaney.cavm@gmail.com>
From: David Daney <david.daney@cavium.com>
When we have a GPIO pin connected to an open-drain network, we want a
standard way of specifying this in the device tree. So we choose bit
1 of the flag field to indicate open drain.
A typical use case would be something like:
enum of_gpio_flags f;
.
.
.
reset_gpio = of_get_named_gpio_flags(node, "reset", 0, &f);
.
.
.
ret = gpio_request_one(reset_gpio,
(f & OF_GPIO_OPEN_DRAIN) ? GPIOF_OPEN_DRAIN : 0,
"reset");
.
.
.
gpio_direction_output(reset_gpio, 1);
gpio_set_value(reset_gpio, 0);
msleep(20);
gpio_set_value(reset_gpio, 1);
.
.
.
Since the same arguments hold for open-source configurations, add a
definition for OF_GPIO_OPEN_SOURCE as well.
Signed-off-by: David Daney <david.daney@cavium.com>
---
include/linux/of_gpio.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index f14123a..cfacf5875 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -30,6 +30,8 @@ struct device_node;
*/
enum of_gpio_flags {
OF_GPIO_ACTIVE_LOW = 0x1,
+ OF_GPIO_OPEN_DRAIN = 0x2,
+ OF_GPIO_OPEN_SOURCE = 0x4,
};
#ifdef CONFIG_OF_GPIO
--
1.7.11.7
next prev parent reply other threads:[~2014-02-11 19:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-11 19:49 [PATCH v2 0/2] of/gpio: Automatic handling of devicetree open-drain GPIO specifications David Daney
2014-02-11 19:49 ` David Daney [this message]
2014-02-12 2:20 ` [PATCH v2 1/2] of/gpio: Define OF_GPIO_OPEN_DRAIN and OF_GPIO_OPEN_SOURCE flags Alexandre Courbot
2014-02-24 12:09 ` Linus Walleij
2014-02-24 12:11 ` Linus Walleij
2014-02-11 19:50 ` [PATCH v2 2/2] of/gpio: Automatically decode OF_GPIO_OPEN_DRAIN and OF_GPIO_OPEN_SOURCE flags in gpiolib David Daney
[not found] ` <1392148200-5393-3-git-send-email-ddaney.cavm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-02-12 2:21 ` Alexandre Courbot
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=1392148200-5393-2-git-send-email-ddaney.cavm@gmail.com \
--to=ddaney.cavm@gmail.com \
--cc=david.daney@cavium.com \
--cc=devicetree@vger.kernel.org \
--cc=gnurou@gmail.com \
--cc=grant.likely@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.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).