From patchwork Wed Sep 7 16:13:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Genoud X-Patchwork-Id: 9319631 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 506DE60752 for ; Wed, 7 Sep 2016 16:16:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3DF27293D6 for ; Wed, 7 Sep 2016 16:16:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3194729403; Wed, 7 Sep 2016 16:16:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BA680293D6 for ; Wed, 7 Sep 2016 16:16:50 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bhfUE-0003qX-Oq; Wed, 07 Sep 2016 16:14:06 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bhfUA-0003k4-5N for linux-arm-kernel@lists.infradead.org; Wed, 07 Sep 2016 16:14:03 +0000 Received: by mail-wm0-x244.google.com with SMTP id l65so3685170wmf.3 for ; Wed, 07 Sep 2016 09:13:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=90Q0eZawPtOOhrutSy0zoUEofVBAfiRLAahp1uKsh/U=; b=p4UVtZOK0eb5vh9771AsdfbPzbRIc0AM7giZtHs5HlbaQmIi9n5UPFqqRmXBrXm16v xm0f+tUfsV4XbBhbqU/6sfghMmn8GExA6dt01PQmPhj6TO5D0q836GRXEaKVz6ZtzJUR MfdCwEezYMe6rBi8SqUc52pcWgwTeZCMh6uebXlwC9SYzbi73j5vIMTeDoN6bC+sn9jD rPxBua8Uk0WbXDbEQ2/YxB0+VHQuptASLo3IiAPD1dE9vPagECTwG/4ypKSlBONrvWkx Hhe7lRslUC/MlEb+lkQI94Fuwm+ek+ko9NFWvun8e4PuIcGKe7BIsknNDIaniQq5XnJe nztA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=90Q0eZawPtOOhrutSy0zoUEofVBAfiRLAahp1uKsh/U=; b=BTnv4T41tspP/BfmEsuaxywQPHwxYu2rgAtPUXmroYygaQLjRGjCDEgJttixfDliRu rN4M7b7Ej6eFF2RDmeSSLNjdNEK7aX0ZC0OnzsCfpXMRLAD4lQeG/2mkdZSZX5WGlylO onkjWQRmzGQKMEtQ3niwTHYH9Mi53kyT/dG2W6pdcU5sEWXYUgVeuNzKDJG8i9shC21j vrZE5MBykK3EDwJXRERr91R+RbLIOMac541Nn/HTP4bFjibyqzeqhwnQhmKjKqfBJ2BK 1xRVU3jrjl4coXsVBoAYQ8hwo8AfJfX0uC7Lx7fiVG2PvLDVaOCqrMZtQyP3Z734EWge 00Gg== X-Gm-Message-State: AE9vXwMn/XzNh0kelLp1sGYptGVG2EkJrk55qtwis4fTox5umlXF8TCHggy6ri6BwLF2zw== X-Received: by 10.28.125.18 with SMTP id y18mr4500814wmc.116.1473264819466; Wed, 07 Sep 2016 09:13:39 -0700 (PDT) Received: from localhost ([46.227.18.67]) by smtp.gmail.com with ESMTPSA id r67sm5023591wmb.14.2016.09.07.09.13.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Sep 2016 09:13:38 -0700 (PDT) From: Richard Genoud To: Cyrille Pitchen , Alexandre Belloni , Nicolas Ferre Subject: [PATCH 1/3] serial: mctrl_gpio: implement mctrl_gpio_use_rtscts Date: Wed, 7 Sep 2016 18:13:22 +0200 Message-Id: <20160907161324.27774-1-richard.genoud@gmail.com> X-Mailer: git-send-email 2.10.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160907_091402_420975_F249BB26 X-CRM114-Status: GOOD ( 11.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Genoud , Greg Kroah-Hartman , linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This function returns true if CTS and RTS are used as GPIOs. Some drivers (like atmel_serial) needs to know if the flow control is handled by the controller or by GPIOs. Signed-off-by: Richard Genoud --- drivers/tty/serial/serial_mctrl_gpio.c | 8 ++++++++ drivers/tty/serial/serial_mctrl_gpio.h | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c index d2da6aa7f27d..93bed8c99796 100644 --- a/drivers/tty/serial/serial_mctrl_gpio.c +++ b/drivers/tty/serial/serial_mctrl_gpio.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -72,6 +73,13 @@ struct gpio_desc *mctrl_gpio_to_gpiod(struct mctrl_gpios *gpios, } EXPORT_SYMBOL_GPL(mctrl_gpio_to_gpiod); +bool mctrl_gpio_use_rtscts(struct mctrl_gpios *gpios) +{ + return !IS_ERR_OR_NULL(mctrl_gpio_to_gpiod(gpios, UART_GPIO_CTS)) && + !IS_ERR_OR_NULL(mctrl_gpio_to_gpiod(gpios, UART_GPIO_RTS)); +} +EXPORT_SYMBOL_GPL(mctrl_gpio_use_rtscts); + unsigned int mctrl_gpio_get(struct mctrl_gpios *gpios, unsigned int *mctrl) { enum mctrl_gpio_idx i; diff --git a/drivers/tty/serial/serial_mctrl_gpio.h b/drivers/tty/serial/serial_mctrl_gpio.h index fa000bcff217..5d423b7f1e1c 100644 --- a/drivers/tty/serial/serial_mctrl_gpio.h +++ b/drivers/tty/serial/serial_mctrl_gpio.h @@ -101,6 +101,11 @@ void mctrl_gpio_enable_ms(struct mctrl_gpios *gpios); */ void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios); +/* + * Return true if both CTS and RTS are used with GPIOs + */ +bool mctrl_gpio_use_rtscts(struct mctrl_gpios *gpios); + #else /* GPIOLIB */ static inline @@ -152,6 +157,10 @@ static inline void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios) { } +static inline bool mctrl_gpio_use_rtscts(struct mctrl_gpios *gpios) +{ +} + #endif /* GPIOLIB */ #endif