From patchwork Tue Sep 27 14:13:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Genoud X-Patchwork-Id: 9351993 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 145046077B for ; Tue, 27 Sep 2016 14:16:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0634E28F50 for ; Tue, 27 Sep 2016 14:16:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EEE4329235; Tue, 27 Sep 2016 14:15:59 +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 2E9A128F50 for ; Tue, 27 Sep 2016 14:15:55 +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 1bot95-00020R-Mp; Tue, 27 Sep 2016 14:14:07 +0000 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bot91-0001yK-5i for linux-arm-kernel@lists.infradead.org; Tue, 27 Sep 2016 14:14:03 +0000 Received: by mail-wm0-x243.google.com with SMTP id b184so1381491wma.3 for ; Tue, 27 Sep 2016 07:13:45 -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=WLaX07AJHTBWSe3rFW201tgjycS6u2qSv9q/BhWsurA=; b=B2sOBr1UjmJGqqzUVrF/AuPDzAqQAXf5hIpc2K4SD4sGJ1ORlrFLsodTNWZKTGeauH 6DoObYUu4GzOOZ4Y4PnV5oHtkbcN1RYDoFJpzSZL7mRTjCCfvSKgFXR2i4qA/R3O6Dk2 1LHFbPpK09wwagRrUnmzYYgA7fFxqESIkFyc7ykupNsKKROY4P9AR7ejt7toIRor3+6V VZnWkuLsy28kPTMghxVRGt1UQDUBaK6LajYLGXp/GPIjSLtmhZ3UFVf9j3ogMDlnb7GE Qw7G0YaGoHv+1+zDkQ14tvn/uhdDQxDKvgsgislCfzVR3JMtPGYOCEwgzFn6/5YaSwNa MBQA== 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=WLaX07AJHTBWSe3rFW201tgjycS6u2qSv9q/BhWsurA=; b=Yatq7UNerWv1IgAgWztODSZ3Hdqt31CHQ+L1Iv/FgeCzeyEZolOzVRBUlBmruSOZue B5OBQ0nszdo2Si7BKbMlyfFjwDpGaqPGqZAauVGGUA0hNmoKNIY0oX4k+09Jc04gZGGq Qmr6mzKy66x3XmmbAzOSZL6n4YlcW3oRPlUhxXfCQfMxqrPmxrvJLmYkPb9AeruxQB9r QbJhEDWAnhJjifBaITGDCiJ347H8pzYZ9m/H6K/E1YIW+uYwy9yVPYTXxQ5CTsypAev8 2qJlkZ/vFhSg8ivt8gezEqPoXW9tUkIxVQbUnwu5PqoQp5N3AA8mTDsXYdEscHFfoLvZ yBkg== X-Gm-Message-State: AA6/9RlOXacQsKcElk3iH/kEdDDz7T0AO36UjZS6b1evOFji770K6zO0ir4jZNlM8LXduw== X-Received: by 10.28.150.1 with SMTP id y1mr3221353wmd.114.1474985624174; Tue, 27 Sep 2016 07:13:44 -0700 (PDT) Received: from localhost ([46.227.18.67]) by smtp.gmail.com with ESMTPSA id n131sm17069874wmd.3.2016.09.27.07.13.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Sep 2016 07:13:43 -0700 (PDT) From: Richard Genoud To: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Nicolas Ferre , Alexandre Belloni , Greg Kroah-Hartman , Cyrille Pitchen Subject: [PATCHv3 1/3] serial: mctrl_gpio: implement mctrl_gpio_use_rtscts Date: Tue, 27 Sep 2016 16:13:11 +0200 Message-Id: <20160927141313.27668-2-richard.genoud@gmail.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20160927141313.27668-1-richard.genoud@gmail.com> References: <20160927141313.27668-1-richard.genoud@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160927_071403_441253_17D28F00 X-CRM114-Status: GOOD ( 11.45 ) 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 | 8 ++++++++ drivers/tty/serial/serial_mctrl_gpio.h | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c index d2da6aa7f27d..0e5525a64c2a 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 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