All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Govindraj.R" <govindraj.raja@ti.com>
To: linux-omap@vger.kernel.org, linux-serial@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Cc: Tony Lindgren <tony@atomide.com>, Kevin Hilman <khilman@ti.com>,
	"Govindraj.R" <govindraj.raja@ti.com>
Subject: [PATCH v3 12/12] OMAP4: Serial: Set TX_FIFO_THRESHOLD if uart in dma mode for es2.0
Date: Wed, 8 Jun 2011 16:53:14 +0530	[thread overview]
Message-ID: <1307532194-13039-13-git-send-email-govindraj.raja@ti.com> (raw)
In-Reply-To: <1307532194-13039-1-git-send-email-govindraj.raja@ti.com>

>From OMAP4430 ES2.0 onwards if uart is configured in dma mode we need to set
uart tx threshold value using the new register UART_TX_DMA_THRESHOLD, this
register can used if UART_MDR3 bit(2) is set. We have to ensure
tx_threshold + tx_trigger <= 63 from es2.0 onwards. By default we are using
tx_trigger of 1 so we can set threshold to 62 to satisfy above criteria.
Without the threshold setting we hit dma_sync lost errors on tx channel
leading to data loss on rx side

Signed-off-by: Govindraj.R <govindraj.raja@ti.com>
---
 arch/arm/mach-omap2/serial.c                  |    4 ++++
 arch/arm/plat-omap/include/plat/omap-serial.h |   11 +++++++++++
 drivers/tty/serial/omap-serial.c              |    5 +++++
 3 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 0a95c95..437fc0b 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -401,6 +401,10 @@ void __init omap_serial_init_port(struct omap_board_data *bdata,
 	if (bdata->id == omap_uart_con_id)
 		pdata->console_uart = true;
 
+	if (pdata->dma_enabled &&
+			cpu_is_omap44xx() && omap_rev() > OMAP4430_REV_ES1_0)
+		pdata->errata |= OMAP4_UART_ERRATA_i659_TX_THR;
+
 	od = omap_device_build(name, bdata->id, oh, pdata,
 				sizeof(*pdata), omap_uart_latency,
 				ARRAY_SIZE(omap_uart_latency), false);
diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h
index 69e6d4b..0d10f72 100644
--- a/arch/arm/plat-omap/include/plat/omap-serial.h
+++ b/arch/arm/plat-omap/include/plat/omap-serial.h
@@ -56,12 +56,23 @@
 #define DEFAULT_RXDMA_BUFSIZE	4096		/* RX DMA buffer size */
 #define DEFAULT_AUTOSUSPEND_DELAY (30 * HZ) /* Runtime autosuspend (msecs) */
 
+/*
+ * (Errata i659) - From OMAP4430 ES 2.0 onwards set
+ * tx_threshold while using UART in DMA Mode
+ * and ensure tx_threshold + tx_trigger <= 63
+ */
+#define UART_MDR3		0x20
+#define UART_TX_DMA_THRESHOLD	0x21
+#define SET_DMA_TX_THRESHOLD	BIT(2)
+/* Setting TX Threshold Level to 62 */
+#define TX_FIFO_THR_LVL		0x3E
 
 #define OMAP_MAX_HSUART_PORTS	4
 
 #define MSR_SAVE_FLAGS		UART_MSR_ANY_DELTA
 
 #define UART_ERRATA_i202_MDR1_ACCESS	BIT(0)
+#define OMAP4_UART_ERRATA_i659_TX_THR	BIT(1)
 
 struct omap_uart_port_info {
 	bool			dma_enabled;	/* To specify DMA Mode */
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index dbe76f3..a9645ac 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -818,6 +818,11 @@ serial_omap_set_termios(struct uart_port *port, struct ktermios *termios,
 	serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B);
 
 	if (up->use_dma) {
+		if (up->errata & OMAP4_UART_ERRATA_i659_TX_THR) {
+			serial_out(up, UART_MDR3, SET_DMA_TX_THRESHOLD);
+			serial_out(up, UART_TX_DMA_THRESHOLD, TX_FIFO_THR_LVL);
+		}
+
 		serial_out(up, UART_TI752_TLR, 0);
 		serial_out(up, UART_OMAP_SCR,
 			(UART_FCR_TRIGGER_4 | UART_FCR_TRIGGER_8));
-- 
1.7.0.4


WARNING: multiple messages have this Message-ID (diff)
From: govindraj.raja@ti.com (Govindraj.R)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 12/12] OMAP4: Serial: Set TX_FIFO_THRESHOLD if uart in dma mode for es2.0
Date: Wed, 8 Jun 2011 16:53:14 +0530	[thread overview]
Message-ID: <1307532194-13039-13-git-send-email-govindraj.raja@ti.com> (raw)
In-Reply-To: <1307532194-13039-1-git-send-email-govindraj.raja@ti.com>


>From bogus@does.not.exist.com  Wed Jun  1 12:03:18 2011
From: bogus@does.not.exist.com ()
Date: Wed, 01 Jun 2011 16:03:18 -0000
Subject: No subject
Message-ID: <mailman.9.1307532245.24103.linux-arm-kernel@lists.infradead.org>

uart tx threshold value using the new register UART_TX_DMA_THRESHOLD, this
register can used if UART_MDR3 bit(2) is set. We have to ensure
tx_threshold + tx_trigger <= 63 from es2.0 onwards. By default we are using
tx_trigger of 1 so we can set threshold to 62 to satisfy above criteria.
Without the threshold setting we hit dma_sync lost errors on tx channel
leading to data loss on rx side

Signed-off-by: Govindraj.R <govindraj.raja@ti.com>
---
 arch/arm/mach-omap2/serial.c                  |    4 ++++
 arch/arm/plat-omap/include/plat/omap-serial.h |   11 +++++++++++
 drivers/tty/serial/omap-serial.c              |    5 +++++
 3 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 0a95c95..437fc0b 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -401,6 +401,10 @@ void __init omap_serial_init_port(struct omap_board_data *bdata,
 	if (bdata->id == omap_uart_con_id)
 		pdata->console_uart = true;
 
+	if (pdata->dma_enabled &&
+			cpu_is_omap44xx() && omap_rev() > OMAP4430_REV_ES1_0)
+		pdata->errata |= OMAP4_UART_ERRATA_i659_TX_THR;
+
 	od = omap_device_build(name, bdata->id, oh, pdata,
 				sizeof(*pdata), omap_uart_latency,
 				ARRAY_SIZE(omap_uart_latency), false);
diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h
index 69e6d4b..0d10f72 100644
--- a/arch/arm/plat-omap/include/plat/omap-serial.h
+++ b/arch/arm/plat-omap/include/plat/omap-serial.h
@@ -56,12 +56,23 @@
 #define DEFAULT_RXDMA_BUFSIZE	4096		/* RX DMA buffer size */
 #define DEFAULT_AUTOSUSPEND_DELAY (30 * HZ) /* Runtime autosuspend (msecs) */
 
+/*
+ * (Errata i659) - From OMAP4430 ES 2.0 onwards set
+ * tx_threshold while using UART in DMA Mode
+ * and ensure tx_threshold + tx_trigger <= 63
+ */
+#define UART_MDR3		0x20
+#define UART_TX_DMA_THRESHOLD	0x21
+#define SET_DMA_TX_THRESHOLD	BIT(2)
+/* Setting TX Threshold Level to 62 */
+#define TX_FIFO_THR_LVL		0x3E
 
 #define OMAP_MAX_HSUART_PORTS	4
 
 #define MSR_SAVE_FLAGS		UART_MSR_ANY_DELTA
 
 #define UART_ERRATA_i202_MDR1_ACCESS	BIT(0)
+#define OMAP4_UART_ERRATA_i659_TX_THR	BIT(1)
 
 struct omap_uart_port_info {
 	bool			dma_enabled;	/* To specify DMA Mode */
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index dbe76f3..a9645ac 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -818,6 +818,11 @@ serial_omap_set_termios(struct uart_port *port, struct ktermios *termios,
 	serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B);
 
 	if (up->use_dma) {
+		if (up->errata & OMAP4_UART_ERRATA_i659_TX_THR) {
+			serial_out(up, UART_MDR3, SET_DMA_TX_THRESHOLD);
+			serial_out(up, UART_TX_DMA_THRESHOLD, TX_FIFO_THR_LVL);
+		}
+
 		serial_out(up, UART_TI752_TLR, 0);
 		serial_out(up, UART_OMAP_SCR,
 			(UART_FCR_TRIGGER_4 | UART_FCR_TRIGGER_8));
-- 
1.7.0.4

  parent reply	other threads:[~2011-06-08 11:23 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-08 11:23 [PATCH v3 00/12] OMAP2+: Serial: Runtime adaptation + cleanup Govindraj.R
2011-06-08 11:23 ` Govindraj.R
2011-06-08 11:23 ` [PATCH v3 01/12] OMAP2+: UART: Remove certain uart calls from sram_idle Govindraj.R
2011-06-08 11:23   ` Govindraj.R
2011-06-08 11:23 ` [PATCH v3 02/12] OMAP2+: UART: Remove uart clock handling code from serial.c Govindraj.R
2011-06-08 11:23   ` Govindraj.R
2011-06-24 22:28   ` Kevin Hilman
2011-06-24 22:28     ` Kevin Hilman
2011-06-27 12:49     ` Govindraj
2011-06-27 12:49       ` Govindraj
2011-06-08 11:23 ` [PATCH v3 03/12] OMAP2+: Serial: Add default mux for all uarts Govindraj.R
2011-06-08 11:23   ` Govindraj.R
2011-06-08 11:23 ` [PATCH v3 04/12] Serial: OMAP: Add runtime pm support for omap-serial driver Govindraj.R
2011-06-08 11:23   ` Govindraj.R
2011-06-08 20:39   ` Jon Hunter
2011-06-08 20:39     ` Jon Hunter
2011-06-09  4:35     ` Govindraj
2011-06-09  4:35       ` Govindraj
2011-06-09 20:49       ` Jon Hunter
2011-06-09 20:49         ` Jon Hunter
2011-06-09 20:51         ` Jon Hunter
2011-06-09 20:51           ` Jon Hunter
2011-06-24 23:30   ` Kevin Hilman
2011-06-24 23:30     ` Kevin Hilman
2011-06-27 14:31     ` Govindraj
2011-06-27 14:31       ` Govindraj
2011-06-27 22:57       ` Kevin Hilman
2011-06-27 22:57         ` Kevin Hilman
2011-06-08 11:23 ` [PATCH v3 05/12] OMAP: Serial: Hold console lock for console usage Govindraj.R
2011-06-08 11:23   ` Govindraj.R
2011-06-25  0:06   ` Kevin Hilman
2011-06-25  0:06     ` Kevin Hilman
2011-06-27 13:35     ` Govindraj
2011-06-27 13:35       ` Govindraj
2011-06-27 22:41       ` Kevin Hilman
2011-06-27 22:41         ` Kevin Hilman
2011-06-08 11:23 ` [PATCH v3 06/12] Serial: OMAP2+: Move erratum handling from serial.c Govindraj.R
2011-06-08 11:23   ` Govindraj.R
2011-06-08 11:23 ` [PATCH v3 07/12] OMAP: Serial: Allow UART parameters to be configured from board file Govindraj.R
2011-06-08 11:23   ` Govindraj.R
2011-06-25  0:12   ` Kevin Hilman
2011-06-25  0:12     ` Kevin Hilman
2011-06-27 12:53     ` Govindraj
2011-06-27 12:53       ` Govindraj
2011-06-08 11:23 ` [PATCH v3 08/12] Serial: OMAP2+: Make the RX_TIMEOUT for DMA configurable for each UART Govindraj.R
2011-06-08 11:23   ` Govindraj.R
2011-06-25  0:16   ` Kevin Hilman
2011-06-25  0:16     ` Kevin Hilman
2011-06-08 11:23 ` [PATCH v3 09/12] OMAP3: Serial: Remove uart pads from 3430 board file Govindraj.R
2011-06-08 11:23   ` Govindraj.R
2011-06-24 22:29   ` Kevin Hilman
2011-06-24 22:29     ` Kevin Hilman
2011-06-27 12:51     ` Govindraj
2011-06-27 12:51       ` Govindraj
2011-06-08 11:23 ` [PATCH v3 10/12] OMAP: Serial: Use resume call from prcm to enable uart Govindraj.R
2011-06-08 11:23   ` Govindraj.R
2011-06-25  0:23   ` Kevin Hilman
2011-06-25  0:23     ` Kevin Hilman
2011-06-27 15:03     ` Govindraj
2011-06-27 15:03       ` Govindraj
2011-06-08 11:23 ` [PATCH v3 11/12] OMAP2: Serial: Add has_async_wake flag Govindraj.R
2011-06-08 11:23   ` Govindraj.R
2011-06-25  0:29   ` Kevin Hilman
2011-06-25  0:29     ` Kevin Hilman
2011-06-27 13:09     ` Govindraj
2011-06-27 13:09       ` Govindraj
2011-06-27 22:28       ` Kevin Hilman
2011-06-27 22:28         ` Kevin Hilman
2011-06-08 11:23 ` Govindraj.R [this message]
2011-06-08 11:23   ` [PATCH v3 12/12] OMAP4: Serial: Set TX_FIFO_THRESHOLD if uart in dma mode for es2.0 Govindraj.R

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=1307532194-13039-13-git-send-email-govindraj.raja@ti.com \
    --to=govindraj.raja@ti.com \
    --cc=khilman@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=tony@atomide.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.