From: nicolas.ferre@atmel.com (Nicolas Ferre)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] ARM/serial: at91: specify RTS in DT using gpio
Date: Tue, 5 Nov 2013 18:29:02 +0100 [thread overview]
Message-ID: <1383672542-10050-1-git-send-email-nicolas.ferre@atmel.com> (raw)
In-Reply-To: <1383665383-5606-1-git-send-email-nicolas.ferre@atmel.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
Documentation/devicetree/bindings/serial/atmel-usart.txt | 3 +++
drivers/tty/serial/atmel_serial.c | 11 ++++++++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/serial/atmel-usart.txt b/Documentation/devicetree/bindings/serial/atmel-usart.txt
index 2191dcb..3adc61c 100644
--- a/Documentation/devicetree/bindings/serial/atmel-usart.txt
+++ b/Documentation/devicetree/bindings/serial/atmel-usart.txt
@@ -10,6 +10,8 @@ Required properties:
Optional properties:
- atmel,use-dma-rx: use of PDC or DMA for receiving data
- atmel,use-dma-tx: use of PDC or DMA for transmitting data
+- rts-gpios: specify a GPIO for RTS line. It will use specified PIO instead of the peripheral
+ function pin for the USART RTS feature. If unsure, don't specify this property.
- add dma bindings for dma transfer:
- dmas: DMA specifier, consisting of a phandle to DMA controller node,
memory peripheral interface and USART DMA channel ID, FIFO configuration.
@@ -28,6 +30,7 @@ Example:
interrupts = <7>;
atmel,use-dma-rx;
atmel,use-dma-tx;
+ rts-gpios = <&pioD 15 0>;
};
- use DMA:
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index b4e0794..582166f 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -35,6 +35,7 @@
#include <linux/platform_device.h>
#include <linux/of.h>
#include <linux/of_device.h>
+#include <linux/of_gpio.h>
#include <linux/dma-mapping.h>
#include <linux/atmel_pdc.h>
#include <linux/atmel_serial.h>
@@ -2364,13 +2365,17 @@ static int atmel_serial_probe(struct platform_device *pdev)
* structs to indicate "no RTS GPIO" instead of open-coding some
* invalid value everywhere.
*/
- if (pdata->rts_gpio > 0) {
- ret = devm_gpio_request(&pdev->dev, pdata->rts_gpio, "RTS");
+ if (pdata && pdata->rts_gpio > 0)
+ port->rts_gpio = pdata->rts_gpio;
+ else if (np)
+ port->rts_gpio = of_get_named_gpio(np, "rts-gpios", 0);
+
+ if (gpio_is_valid(port->rts_gpio)) {
+ ret = devm_gpio_request(&pdev->dev, port->rts_gpio, "RTS");
if (ret) {
dev_err(&pdev->dev, "error requesting RTS GPIO\n");
goto err;
}
- port->rts_gpio = pdata->rts_gpio;
ret = gpio_direction_output(port->rts_gpio, 0);
if (ret) {
dev_err(&pdev->dev, "error setting up RTS GPIO\n");
--
1.8.2.2
next prev parent reply other threads:[~2013-11-05 17:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-05 12:35 [PATCH] ARM/serial: at91: switch atmel serial to use gpiolib Linus Walleij
2013-11-05 15:27 ` Nicolas Ferre
2013-11-05 15:29 ` [PATCH] ARM/serial: at91: specify RTS in DT using gpio Nicolas Ferre
2013-11-05 15:59 ` Jean-Christophe PLAGNIOL-VILLARD
2013-11-05 16:18 ` Andrew Lunn
2013-11-05 16:57 ` Nicolas Ferre
2013-11-05 17:29 ` Nicolas Ferre [this message]
2013-11-05 16:28 ` [PATCH] ARM/serial: at91: switch atmel serial to use gpiolib Jean-Christophe PLAGNIOL-VILLARD
2013-11-05 16:52 ` Nicolas Ferre
2013-11-06 9:16 ` Linus Walleij
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=1383672542-10050-1-git-send-email-nicolas.ferre@atmel.com \
--to=nicolas.ferre@atmel.com \
--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).