public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] serial: samsung: add support for manual RTS setting
@ 2013-09-11 10:08 José Miguel Gonçalves
  2013-09-17 10:18 ` Tomasz Figa
  0 siblings, 1 reply; 6+ messages in thread
From: José Miguel Gonçalves @ 2013-09-11 10:08 UTC (permalink / raw)
  To: linux-samsung-soc
  Cc: linux-kernel, linux-serial, José Miguel Gonçalves

The Samsung serial driver currently does not support setting the
RTS pin with an ioctl(TIOCMSET) call. This patch adds this support.

Signed-off-by: José Miguel Gonçalves <jose.goncalves@inov.pt>
---
 drivers/tty/serial/samsung.c |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index f3dfa19..e5dd808 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -407,7 +407,14 @@ static unsigned int s3c24xx_serial_get_mctrl(struct uart_port *port)
 
 static void s3c24xx_serial_set_mctrl(struct uart_port *port, unsigned int mctrl)
 {
-	/* todo - possibly remove AFC and do manual CTS */
+	unsigned int umcon = rd_regl(port, S3C2410_UMCON);
+
+	if (mctrl & TIOCM_RTS)
+		umcon |= S3C2410_UMCOM_RTS_LOW;
+	else
+		umcon &= ~S3C2410_UMCOM_RTS_LOW;
+
+	wr_regl(port, S3C2410_UMCON, umcon);
 }
 
 static void s3c24xx_serial_break_ctl(struct uart_port *port, int break_state)
@@ -774,8 +781,6 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
 	if (termios->c_cflag & CSTOPB)
 		ulcon |= S3C2410_LCON_STOPB;
 
-	umcon = (termios->c_cflag & CRTSCTS) ? S3C2410_UMCOM_AFC : 0;
-
 	if (termios->c_cflag & PARENB) {
 		if (termios->c_cflag & PARODD)
 			ulcon |= S3C2410_LCON_PODD;
@@ -792,6 +797,12 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
 
 	wr_regl(port, S3C2410_ULCON, ulcon);
 	wr_regl(port, S3C2410_UBRDIV, quot);
+
+	if (termios->c_cflag & CRTSCTS)
+		umcon = S3C2410_UMCOM_AFC;
+	else
+		umcon = rd_regb(port, S3C2410_UMCON) & ~S3C2410_UMCOM_AFC;
+
 	wr_regl(port, S3C2410_UMCON, umcon);
 
 	if (ourport->info->has_divslot)
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-09-18  9:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-11 10:08 [PATCH] serial: samsung: add support for manual RTS setting José Miguel Gonçalves
2013-09-17 10:18 ` Tomasz Figa
2013-09-17 13:03   ` José Miguel Gonçalves
2013-09-17 15:21     ` Tomasz Figa
2013-09-17 19:08       ` José Miguel Gonçalves
2013-09-18  9:40         ` Tomasz Figa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox