From patchwork Tue Nov 5 15:29:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Ferre X-Patchwork-Id: 3142371 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B2B269F407 for ; Tue, 5 Nov 2013 15:30:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 46EF0205C4 for ; Tue, 5 Nov 2013 15:30:19 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 767E420586 for ; Tue, 5 Nov 2013 15:30:17 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vdia4-00027Z-El; Tue, 05 Nov 2013 15:30:12 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vdia2-0005Xt-2K; Tue, 05 Nov 2013 15:30:10 +0000 Received: from eusmtp01.atmel.com ([212.144.249.242]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VdiZy-0005XR-2U for linux-arm-kernel@lists.infradead.org; Tue, 05 Nov 2013 15:30:07 +0000 Received: from tenerife.corp.atmel.com (10.161.101.13) by eusmtp01.atmel.com (10.161.101.30) with Microsoft SMTP Server id 14.2.347.0; Tue, 5 Nov 2013 16:29:41 +0100 From: Nicolas Ferre To: , , , Subject: [PATCH] ARM/serial: at91: specify RTS in DT using gpio Date: Tue, 5 Nov 2013 16:29:43 +0100 Message-ID: <1383665383-5606-1-git-send-email-nicolas.ferre@atmel.com> X-Mailer: git-send-email 1.8.2.2 In-Reply-To: <1383654959-18112-1-git-send-email-linus.walleij@linaro.org> References: <1383654959-18112-1-git-send-email-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131105_103006_359406_01E5CB70 X-CRM114-Status: GOOD ( 12.51 ) X-Spam-Score: -1.9 (-) Cc: Nicolas Ferre , acourbot@nvidia.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Nicolas Ferre --- Documentation/devicetree/bindings/serial/atmel-usart.txt | 3 +++ drivers/tty/serial/atmel_serial.c | 13 ++++++++++--- 2 files changed, 13 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..71f8ea9 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -2327,6 +2328,7 @@ static int atmel_serial_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; struct atmel_uart_data *pdata = dev_get_platdata(&pdev->dev); void *data; + int rts_pin = -EINVAL; int ret = -ENODEV; BUILD_BUG_ON(ATMEL_SERIAL_RINGSIZE & (ATMEL_SERIAL_RINGSIZE - 1)); @@ -2364,13 +2366,18 @@ 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) + rts_pin = pdata->rts_gpio; + else if (np) + rts_pin = of_get_named_gpio(np, "rts-gpios", 0); + + if (gpio_is_valid(rts_pin)) { + ret = devm_gpio_request(&pdev->dev, rts_pin, "RTS"); if (ret) { dev_err(&pdev->dev, "error requesting RTS GPIO\n"); goto err; } - port->rts_gpio = pdata->rts_gpio; + port->rts_gpio = rts_pin; ret = gpio_direction_output(port->rts_gpio, 0); if (ret) { dev_err(&pdev->dev, "error setting up RTS GPIO\n");