Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1493967 > unrolled thread

[PATCHv4 0/3] Fix hardware handshake on SAM9x5 platforms

Started byRichard Genoud <richard.genoud@gmail.com>
First post2016-09-30 11:00 +0200
Last post2016-10-04 09:30 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCHv4 0/3] Fix hardware handshake on SAM9x5 platforms Richard Genoud <richard.genoud@gmail.com> - 2016-09-30 11:00 +0200
    [PATCHv4 1/3] serial: mctrl_gpio: implement mctrl_gpio_use_rtscts Richard Genoud <richard.genoud@gmail.com> - 2016-09-30 11:00 +0200
      Re: [PATCHv4 1/3] serial: mctrl_gpio: implement mctrl_gpio_use_rtscts Uwe Kleine-König          <u.kleine-koenig@pengutronix.de> - 2016-10-04 09:30 +0200

#1493967 — [PATCHv4 0/3] Fix hardware handshake on SAM9x5 platforms

FromRichard Genoud <richard.genoud@gmail.com>
Date2016-09-30 11:00 +0200
Subject[PATCHv4 0/3] Fix hardware handshake on SAM9x5 platforms
Message-ID<sn1PN-7WT-13@gated-at.bofh.it>
Since commit 1cf6e8fc8341 ("tty/serial: at91: fix RTS line management when
hardware handshake is enabled"), hardware handshake is not working
anymore on SAM9x5/SAMA5D3/SAM9 platforms.

The first two patches fix the hardware handshake when CTS/RTS pins are
handled by GPIOs.

The last patch fixes hardware handshake when CTS/RTS pins are not GPIOs.

Changes since v3:
 - remove superfuous #include <linux/err.h> (thanks to Uwe)
 - rebase on next-20160930

Changes since v2:
 - remove IS_ERR_OR_NULL() test in patch 1/3 as Uwe suggested.
 - fix typos in patch 2/3
 - rebase on next-20160927
 - simplify the logic in patch 3/3.

Changes since v1:
 - Correct patch 1 with the error found by kbuild.
 - Add Alexandre's Acked-by on patch 2
 - Rewrite patch 3 logic in the light of the on-going discussion
   with Cyrille and Alexandre.

NB: patch 2 NEEDS patch 1 to compile.

Richard Genoud (3):
  serial: mctrl_gpio: implement mctrl_gpio_use_rtscts
  tty/serial: at91: fix hardware handshake with GPIOs
  tty/serial: at91: fix hardware handshake on SAM9x5 (without GPIOs)

 drivers/tty/serial/atmel_serial.c      | 26 +++++++++++++++++---------
 drivers/tty/serial/serial_mctrl_gpio.c |  7 +++++++
 drivers/tty/serial/serial_mctrl_gpio.h | 10 ++++++++++
 3 files changed, 34 insertions(+), 9 deletions(-)

[toc] | [next] | [standalone]


#1493968 — [PATCHv4 1/3] serial: mctrl_gpio: implement mctrl_gpio_use_rtscts

FromRichard Genoud <richard.genoud@gmail.com>
Date2016-09-30 11:00 +0200
Subject[PATCHv4 1/3] serial: mctrl_gpio: implement mctrl_gpio_use_rtscts
Message-ID<sn1PN-7WT-23@gated-at.bofh.it>
In reply to#1493967
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 <richard.genoud@gmail.com>
---
 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

[toc] | [prev] | [next] | [standalone]


#1495237 — Re: [PATCHv4 1/3] serial: mctrl_gpio: implement mctrl_gpio_use_rtscts

FromUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date2016-10-04 09:30 +0200
SubjectRe: [PATCHv4 1/3] serial: mctrl_gpio: implement mctrl_gpio_use_rtscts
Message-ID<soskO-7UY-11@gated-at.bofh.it>
In reply to#1493968
Hello Greg,

On Fri, Sep 30, 2016 at 10:57:59AM +0200, Richard Genoud wrote:
> 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.

just for the record: I don't like this patch because I think it's highly
at91 specific and could so well live in that driver. Moreover I'm not
conviced yet that it's really the correct thing to do even for this
driver. So please don't apply, at least until we're done with the
discussion of patch 2.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web