linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial imx.c: fix CTS trigger level lower to avoid lost chars
@ 2010-01-21 21:26 Valentin Longchamp
  2010-01-21 22:06 ` Wolfram Sang
  2010-01-22 11:58 ` Wolfram Sang
  0 siblings, 2 replies; 12+ messages in thread
From: Valentin Longchamp @ 2010-01-21 21:26 UTC (permalink / raw)
  To: linux-arm-kernel

The imx CTS trigger level is left at its reset value that is 32
chars. Since the RX FIFO has 32 entries, when CTS is raised, the
FIFO already is full. However, some serial port devices first empty
their TX FIFO before stopping when CTS is raised, resulting in lost
chars.

This patch sets the trigger level lower so that other chars arrive
after CTS is raised, there is still room for 16 of them.

Signed-off-by: Valentin Longchamp <valentin.longchamp@epfl.ch>
Tested-by: Philippe R?tornaz <philippe.retornaz@epfl.ch>
---
 drivers/serial/imx.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index 18130f1..f7d2da5 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -119,7 +119,8 @@
 #define  MX2_UCR3_RXDMUXSEL	 (1<<2)  /* RXD Muxed Input Select, on mx2/mx3 */
 #define  UCR3_INVT  	 (1<<1)  /* Inverted Infrared transmission */
 #define  UCR3_BPEN  	 (1<<0)  /* Preset registers enable */
-#define  UCR4_CTSTL_32   (32<<10) /* CTS trigger level (32 chars) */
+#define  UCR4_CTSTL_SHF  10      /* CTS trigger level shift */
+#define  UCR4_CTSTL_MASK 0x3F    /* CTS trigger is 6 bits wide */
 #define  UCR4_INVR  	 (1<<9)  /* Inverted infrared reception */
 #define  UCR4_ENIRI 	 (1<<8)  /* Serial infrared interrupt enable */
 #define  UCR4_WKEN  	 (1<<7)  /* Wake interrupt enable */
@@ -590,6 +591,8 @@ static int imx_setup_ufcr(struct imx_port *sport, unsigned int mode)
 	return 0;
 }
 
+#define CTSTL 16
+
 static int imx_startup(struct uart_port *port)
 {
 	struct imx_port *sport = (struct imx_port *)port;
@@ -606,6 +609,11 @@ static int imx_startup(struct uart_port *port)
 	if (USE_IRDA(sport))
 		temp |= UCR4_IRSC;
 
+	/* set the trigger level for CTS to 16 by default
+	 */
+	temp &= ~(UCR4_CTSTL_MASK << UCR4_CTSTL_SHF);
+	temp |= CTSTL << UCR4_CTSTL_SHF;
+
 	writel(temp & ~UCR4_DREN, sport->port.membase + UCR4);
 
 	if (USE_IRDA(sport)) {
-- 
1.6.3.3

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

end of thread, other threads:[~2010-01-24 10:48 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-21 21:26 [PATCH] serial imx.c: fix CTS trigger level lower to avoid lost chars Valentin Longchamp
2010-01-21 22:06 ` Wolfram Sang
2010-01-21 22:11   ` Russell King - ARM Linux
2010-01-22 10:14     ` Valentin Longchamp
2010-01-22 11:07       ` Jamie Lokier
2010-01-22 11:31         ` Russell King - ARM Linux
2010-01-22 11:49           ` Wolfram Sang
2010-01-22 16:47             ` Jamie Lokier
2010-01-22 16:47           ` Jamie Lokier
2010-01-22 16:57             ` Russell King - ARM Linux
2010-01-22 11:58 ` Wolfram Sang
2010-01-24 10:48   ` Valentin Longchamp

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).