linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Shiyan <shc_work@mail.ru>
To: linux-serial@vger.kernel.org
Cc: Alan Cox <alan@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Alexander Shiyan <shc_work@mail.ru>
Subject: [PATCH 11/12] serial: clps711x: Fix TERMIOS-flags handling
Date: Sun, 14 Oct 2012 11:05:33 +0400	[thread overview]
Message-ID: <1350198334-18737-11-git-send-email-shc_work@mail.ru> (raw)
In-Reply-To: <1350198334-18737-1-git-send-email-shc_work@mail.ru>


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/tty/serial/clps711x.c |   36 ++++++++++++------------------------
 1 files changed, 12 insertions(+), 24 deletions(-)

diff --git a/drivers/tty/serial/clps711x.c b/drivers/tty/serial/clps711x.c
index e715087..90efe05 100644
--- a/drivers/tty/serial/clps711x.c
+++ b/drivers/tty/serial/clps711x.c
@@ -273,10 +273,9 @@ clps711xuart_set_termios(struct uart_port *port, struct ktermios *termios,
 	unsigned int ubrlcr, baud, quot;
 	unsigned long flags;
 
-	/*
-	 * We don't implement CREAD.
-	 */
-	termios->c_cflag |= CREAD;
+	/* Mask termios capabilities we don't support */
+	termios->c_cflag &= ~CMSPAR;
+	termios->c_iflag &= ~(BRKINT | IGNBRK);
 
 	/* Ask the core to calculate the divisor for us */
 	baud = uart_get_baud_rate(port, termios, old, port->uartclk / 4096,
@@ -297,8 +296,10 @@ clps711xuart_set_termios(struct uart_port *port, struct ktermios *termios,
 		ubrlcr = UBRLCR_WRDLEN8;
 		break;
 	}
+
 	if (termios->c_cflag & CSTOPB)
 		ubrlcr |= UBRLCR_XSTOP;
+
 	if (termios->c_cflag & PARENB) {
 		ubrlcr |= UBRLCR_PRTEN;
 		if (!(termios->c_cflag & PARODD))
@@ -310,33 +311,20 @@ clps711xuart_set_termios(struct uart_port *port, struct ktermios *termios,
 
 	spin_lock_irqsave(&port->lock, flags);
 
-	/*
-	 * Update the per-port timeout.
-	 */
-	uart_update_timeout(port, termios->c_cflag, baud);
-
+	/* Set read status mask */
 	port->read_status_mask = UARTDR_OVERR;
 	if (termios->c_iflag & INPCK)
 		port->read_status_mask |= UARTDR_PARERR | UARTDR_FRMERR;
 
-	/*
-	 * Characters to ignore
-	 */
+	/* Set status ignore mask */
 	port->ignore_status_mask = 0;
-	if (termios->c_iflag & IGNPAR)
-		port->ignore_status_mask |= UARTDR_FRMERR | UARTDR_PARERR;
-	if (termios->c_iflag & IGNBRK) {
-		/*
-		 * If we're ignoring parity and break indicators,
-		 * ignore overruns to (for real raw support).
-		 */
-		if (termios->c_iflag & IGNPAR)
-			port->ignore_status_mask |= UARTDR_OVERR;
-	}
+	if (!(termios->c_cflag & CREAD))
+		port->ignore_status_mask |= UARTDR_OVERR | UARTDR_PARERR |
+					    UARTDR_FRMERR;
 
-	quot -= 1;
+	uart_update_timeout(port, termios->c_cflag, baud);
 
-	clps_writel(ubrlcr | quot, UBRLCR(port));
+	clps_writel(ubrlcr | (quot - 1), UBRLCR(port));
 
 	spin_unlock_irqrestore(&port->lock, flags);
 }
-- 
1.7.8.6


  parent reply	other threads:[~2012-10-14  7:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-14  7:05 [PATCH 01/12] serial: clps711x: Add platform_driver interface to clps711x driver Alexander Shiyan
2012-10-14  7:05 ` [PATCH 02/12] serial: clps711x: Convert all static variables to dynamic Alexander Shiyan
2012-10-14  7:05 ` [PATCH 03/12] serial: clps711x: Do not use "uart_port->unused" field Alexander Shiyan
2012-10-14  7:05 ` [PATCH 04/12] serial: clps711x: Using CPU clock subsystem for getting base UART speed Alexander Shiyan
2012-10-14  7:05 ` [PATCH 05/12] serial: clps711x: Improved TX FIFO handling Alexander Shiyan
2012-10-14  7:05 ` [PATCH 06/12] serial: clps711x: Return valid modem controls for port that not support it Alexander Shiyan
2012-10-14  7:05 ` [PATCH 07/12] serial: clps711x: Fix break control handling Alexander Shiyan
2012-10-14  7:05 ` [PATCH 08/12] serial: clps711x: Check for valid TTY in RX-interrupt Alexander Shiyan
2012-10-14  7:05 ` [PATCH 09/12] serial: clps711x: Using resource-managed functions Alexander Shiyan
2012-10-14  7:05 ` [PATCH 10/12] serial: clps711x: Disable "break"-state before port startup Alexander Shiyan
2012-10-14  7:05 ` Alexander Shiyan [this message]
2012-10-14  7:05 ` [PATCH 12/12] serial: clps711x: Cleanup driver Alexander Shiyan
2012-10-14  7:54 ` [PATCH 01/12] serial: clps711x: Add platform_driver interface to clps711x driver Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1350198334-18737-11-git-send-email-shc_work@mail.ru \
    --to=shc_work@mail.ru \
    --cc=alan@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).