From patchwork Fri Sep 30 08:57:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Genoud X-Patchwork-Id: 9357827 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 238FB6086A for ; Fri, 30 Sep 2016 09:01:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12BBB29F22 for ; Fri, 30 Sep 2016 09:01:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0795929F26; Fri, 30 Sep 2016 09:01:44 +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 2C6D529F25 for ; Fri, 30 Sep 2016 09:01:42 +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 1bptg8-0001ek-Mn; Fri, 30 Sep 2016 09:00:24 +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 1bptea-0008Ta-Tu for linux-arm-kernel@lists.infradead.org; Fri, 30 Sep 2016 08:58:51 +0000 Received: by mail-wm0-x244.google.com with SMTP id p197so953541wmg.1 for ; Fri, 30 Sep 2016 01:58:28 -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:in-reply-to:references; bh=2d5n+bZsmgA9pnLa0WxlfRYHWt5NwQnXWfvXBlgEpBA=; b=OAZJX3s3O4sUaaupNNLZdYNZyqFg0EYgKZeCrZ7zi12BvL0dSFVHDdK96qgRZ9t22x 1ShxUu8twRnTdEhaY9R7+bMzV+15I+gF91Xlv6dily6r3anneCdtUFeg9yVRLeq7mtz3 zgMmsNybKMaWOxaIHsnnbM7LNEi3I/55XU2seziqiDC8xeMK3vEkX9xzIPHPpyMUGn6K JMEr1SSXvsjVZ4ItLVSkMv0doY8vbuYLulszSayuuyUxsjCeCn6EUbvJCgIiDLOJx+Pz g3FswsP3bewxGAllFVt7S1P1XfNvtPT7l6yjI6UV8Vx+SG2Ty9wwiM2FMcVVQ5ME4kij M8pA== 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:in-reply-to :references; bh=2d5n+bZsmgA9pnLa0WxlfRYHWt5NwQnXWfvXBlgEpBA=; b=gtZVDWyaufFwyNEBrVxFvWgJzYupcgS25p8Y0/sPQ7jEpya/eyiccKMpiJ88M5C2A/ DtGyD5fZC7YOXkR/qO2CzylyaKTIOHLt4ST2cf5HU5cVpK1GUHRMY2DpF7LxUmd+MFvB fl9Bm1VrezFkMJ9GwdY//42DZybsYPitISeQfyivrm/jizC+MWz0VNe48XkgurpPIIJl e7XiCQjTJUBkIFIafSaUXdaWh+xKgxo6DeQB2yFamwNNcR0Ud8u5bzkNEwjD1lVMAc9o 6JCQpDsTJX70e1jw4z8aOC5+T7jkgrinCqoHpi2eYgfbRRLem/pJtdkRIqu/2EjyKab3 t0/Q== X-Gm-Message-State: AA6/9RmedmxBjG4oGlZhcpY1cbfgV40S7ykQsY3gMsAq78tDqFkftySVaGQ7UmVx97qWEw== X-Received: by 10.28.109.86 with SMTP id i83mr2601337wmc.104.1475225907107; Fri, 30 Sep 2016 01:58:27 -0700 (PDT) Received: from localhost ([46.227.18.67]) by smtp.gmail.com with ESMTPSA id u7sm7184463wjt.45.2016.09.30.01.58.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Sep 2016 01:58:26 -0700 (PDT) From: Richard Genoud To: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Nicolas Ferre , Alexandre Belloni , Greg Kroah-Hartman , Cyrille Pitchen Subject: [PATCHv4 1/3] serial: mctrl_gpio: implement mctrl_gpio_use_rtscts Date: Fri, 30 Sep 2016 10:57:59 +0200 Message-Id: <20160930085801.21497-2-richard.genoud@gmail.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20160930085801.21497-1-richard.genoud@gmail.com> References: <20160930085801.21497-1-richard.genoud@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160930_015849_321984_B85CC5B0 X-CRM114-Status: GOOD ( 10.24 ) 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: linux-arm-kernel@lists.infradead.org, Richard Genoud , linux-kernel@vger.kernel.org, linux-serial@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 | 7 +++++++ drivers/tty/serial/serial_mctrl_gpio.h | 10 ++++++++++ 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..38e6e784faa2 100644 --- a/drivers/tty/serial/serial_mctrl_gpio.c +++ b/drivers/tty/serial/serial_mctrl_gpio.c @@ -72,6 +72,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 mctrl_gpio_to_gpiod(gpios, UART_GPIO_CTS) && + 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..c34269733c62 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,11 @@ static inline void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios) { } +static inline bool mctrl_gpio_use_rtscts(struct mctrl_gpios *gpios) +{ + return false; +} + #endif /* GPIOLIB */ #endif