aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2012-01-21 02:27:40 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2012-01-24 17:11:07 -0500
commit0a697b22252c9d7208b5fb3e9fbd124dd229f1d2 (patch)
treee1558fc3fe171d9e30394afe90982aa69733e449 /drivers/tty/serial
parentb5148856a2f732e7e99edad22bb8e2037af28ad3 (diff)
tty: serial: OMAP: ensure FIFO levels are set correctly in non-DMA mode
Ensure FIFO levels are set correctly in non-DMA mode (the default). This patch will cause a receive FIFO threshold interrupt to be raised when there is at least one byte in the RX FIFO. It will also cause a transmit FIFO threshold interrupt when there is only one byte remaining in the TX FIFO. These changes fix the receive interrupt problem and part of the transmit interrupt problem. A separate set of issues must be worked around for the transmit path to have a basic level of functionality; a subsequent patch will address these. DMA operation is unaffected by this patch. Signed-off-by: Paul Walmsley <paul@pwsan.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Govindraj Raja <govindraj.r@ti.com> Cc: Kevin Hilman <khilman@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/tty/serial')
-rw-r--r--drivers/tty/serial/omap-serial.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 1c2426931484..ca54f038ab45 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -46,6 +46,18 @@
46 46
47#define DEFAULT_CLK_SPEED 48000000 /* 48Mhz*/ 47#define DEFAULT_CLK_SPEED 48000000 /* 48Mhz*/
48 48
49/* SCR register bitmasks */
50#define OMAP_UART_SCR_RX_TRIG_GRANU1_MASK (1 << 7)
51#define OMAP_UART_SCR_TX_TRIG_GRANU1_MASK (1 << 6)
52
53/* FCR register bitmasks */
54#define OMAP_UART_FCR_RX_FIFO_TRIG_SHIFT 6
55#define OMAP_UART_FCR_RX_FIFO_TRIG_MASK (0x3 << 6)
56#define OMAP_UART_FCR_TX_FIFO_TRIG_SHIFT 4
57
58/* TLR register bitmasks */
59#define OMAP_UART_TLR_TX_FIFO_TRIG_DMA_SHIFT 0
60
49static struct uart_omap_port *ui[OMAP_MAX_HSUART_PORTS]; 61static struct uart_omap_port *ui[OMAP_MAX_HSUART_PORTS];
50 62
51/* Forward declaration of functions */ 63/* Forward declaration of functions */
@@ -694,6 +706,7 @@ serial_omap_set_termios(struct uart_port *port, struct ktermios *termios,
694 unsigned char efr = 0; 706 unsigned char efr = 0;
695 unsigned long flags = 0; 707 unsigned long flags = 0;
696 unsigned int baud, quot; 708 unsigned int baud, quot;
709 u32 tlr;
697 710
698 switch (termios->c_cflag & CSIZE) { 711 switch (termios->c_cflag & CSIZE) {
699 case CS5: 712 case CS5:
@@ -811,14 +824,28 @@ serial_omap_set_termios(struct uart_port *port, struct ktermios *termios,
811 up->mcr = serial_in(up, UART_MCR); 824 up->mcr = serial_in(up, UART_MCR);
812 serial_out(up, UART_MCR, up->mcr | UART_MCR_TCRTLR); 825 serial_out(up, UART_MCR, up->mcr | UART_MCR_TCRTLR);
813 /* FIFO ENABLE, DMA MODE */ 826 /* FIFO ENABLE, DMA MODE */
814 serial_out(up, UART_FCR, up->fcr); 827
815 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); 828 up->scr |= OMAP_UART_SCR_TX_TRIG_GRANU1_MASK;
829 up->scr |= OMAP_UART_SCR_RX_TRIG_GRANU1_MASK;
816 830
817 if (up->use_dma) { 831 if (up->use_dma) {
818 serial_out(up, UART_TI752_TLR, 0); 832 tlr = 0;
819 up->scr |= (UART_FCR_TRIGGER_4 | UART_FCR_TRIGGER_8); 833 } else {
834 up->scr &= ~OMAP_UART_SCR_TX_EMPTY;
835
836 /* Set receive FIFO threshold to 1 */
837 up->fcr &= ~OMAP_UART_FCR_RX_FIFO_TRIG_MASK;
838 up->fcr |= (0x1 << OMAP_UART_FCR_RX_FIFO_TRIG_SHIFT);
839
840 /* Set TX FIFO threshold to "63" (actually 1) */
841 up->fcr |= (0x3 << OMAP_UART_FCR_TX_FIFO_TRIG_SHIFT);
842 tlr = (0xf << OMAP_UART_TLR_TX_FIFO_TRIG_DMA_SHIFT);
820 } 843 }
821 844
845 serial_out(up, UART_TI752_TLR, tlr);
846 serial_out(up, UART_FCR, up->fcr);
847 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B);
848
822 serial_out(up, UART_OMAP_SCR, up->scr); 849 serial_out(up, UART_OMAP_SCR, up->scr);
823 850
824 serial_out(up, UART_EFR, up->efr); 851 serial_out(up, UART_EFR, up->efr);