aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/bfin_5xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/bfin_5xx.c')
-rw-r--r--drivers/serial/bfin_5xx.c58
1 files changed, 4 insertions, 54 deletions
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c
index 8a2f6a1baa74..869c99aa77a4 100644
--- a/drivers/serial/bfin_5xx.c
+++ b/drivers/serial/bfin_5xx.c
@@ -65,9 +65,6 @@ static void bfin_serial_stop_tx(struct uart_port *port)
65{ 65{
66 struct bfin_serial_port *uart = (struct bfin_serial_port *)port; 66 struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
67 struct circ_buf *xmit = &uart->port.info->xmit; 67 struct circ_buf *xmit = &uart->port.info->xmit;
68#if !defined(CONFIG_BF54x) && !defined(CONFIG_SERIAL_BFIN_DMA)
69 unsigned short ier;
70#endif
71 68
72 while (!(UART_GET_LSR(uart) & TEMT)) 69 while (!(UART_GET_LSR(uart) & TEMT))
73 cpu_relax(); 70 cpu_relax();
@@ -82,12 +79,8 @@ static void bfin_serial_stop_tx(struct uart_port *port)
82#ifdef CONFIG_BF54x 79#ifdef CONFIG_BF54x
83 /* Clear TFI bit */ 80 /* Clear TFI bit */
84 UART_PUT_LSR(uart, TFI); 81 UART_PUT_LSR(uart, TFI);
85 UART_CLEAR_IER(uart, ETBEI);
86#else
87 ier = UART_GET_IER(uart);
88 ier &= ~ETBEI;
89 UART_PUT_IER(uart, ier);
90#endif 82#endif
83 UART_CLEAR_IER(uart, ETBEI);
91#endif 84#endif
92} 85}
93 86
@@ -102,14 +95,7 @@ static void bfin_serial_start_tx(struct uart_port *port)
102 if (uart->tx_done) 95 if (uart->tx_done)
103 bfin_serial_dma_tx_chars(uart); 96 bfin_serial_dma_tx_chars(uart);
104#else 97#else
105#ifdef CONFIG_BF54x
106 UART_SET_IER(uart, ETBEI); 98 UART_SET_IER(uart, ETBEI);
107#else
108 unsigned short ier;
109 ier = UART_GET_IER(uart);
110 ier |= ETBEI;
111 UART_PUT_IER(uart, ier);
112#endif
113 bfin_serial_tx_chars(uart); 99 bfin_serial_tx_chars(uart);
114#endif 100#endif
115} 101}
@@ -120,21 +106,10 @@ static void bfin_serial_start_tx(struct uart_port *port)
120static void bfin_serial_stop_rx(struct uart_port *port) 106static void bfin_serial_stop_rx(struct uart_port *port)
121{ 107{
122 struct bfin_serial_port *uart = (struct bfin_serial_port *)port; 108 struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
123#ifdef CONFIG_KGDB_UART 109#ifdef CONFIG_KGDB_UART
124 if (uart->port.line != CONFIG_KGDB_UART_PORT) { 110 if (uart->port.line != CONFIG_KGDB_UART_PORT)
125#endif 111#endif
126#ifdef CONFIG_BF54x
127 UART_CLEAR_IER(uart, ERBFI); 112 UART_CLEAR_IER(uart, ERBFI);
128#else
129 unsigned short ier;
130
131 ier = UART_GET_IER(uart);
132 ier &= ~ERBFI;
133 UART_PUT_IER(uart, ier);
134#endif
135#ifdef CONFIG_KGDB_UART
136 }
137#endif
138} 113}
139 114
140/* 115/*
@@ -208,9 +183,6 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
208 struct tty_struct *tty = uart->port.info->tty; 183 struct tty_struct *tty = uart->port.info->tty;
209 unsigned int status, ch, flg; 184 unsigned int status, ch, flg;
210 static struct timeval anomaly_start = { .tv_sec = 0 }; 185 static struct timeval anomaly_start = { .tv_sec = 0 };
211#ifdef CONFIG_KGDB_UART
212 struct pt_regs *regs = get_irq_regs();
213#endif
214 186
215 status = UART_GET_LSR(uart); 187 status = UART_GET_LSR(uart);
216 UART_CLEAR_LSR(uart); 188 UART_CLEAR_LSR(uart);
@@ -220,6 +192,7 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
220 192
221#ifdef CONFIG_KGDB_UART 193#ifdef CONFIG_KGDB_UART
222 if (uart->port.line == CONFIG_KGDB_UART_PORT) { 194 if (uart->port.line == CONFIG_KGDB_UART_PORT) {
195 struct pt_regs *regs = get_irq_regs();
223 if (uart->port.cons->index == CONFIG_KGDB_UART_PORT && ch == 0x1) { /* Ctrl + A */ 196 if (uart->port.cons->index == CONFIG_KGDB_UART_PORT && ch == 0x1) { /* Ctrl + A */
224 kgdb_breakkey_pressed(regs); 197 kgdb_breakkey_pressed(regs);
225 return; 198 return;
@@ -391,7 +364,6 @@ static void bfin_serial_do_work(struct work_struct *work)
391static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart) 364static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart)
392{ 365{
393 struct circ_buf *xmit = &uart->port.info->xmit; 366 struct circ_buf *xmit = &uart->port.info->xmit;
394 unsigned short ier;
395 367
396 uart->tx_done = 0; 368 uart->tx_done = 0;
397 369
@@ -429,13 +401,7 @@ static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart)
429 set_dma_x_modify(uart->tx_dma_channel, 1); 401 set_dma_x_modify(uart->tx_dma_channel, 1);
430 enable_dma(uart->tx_dma_channel); 402 enable_dma(uart->tx_dma_channel);
431 403
432#ifdef CONFIG_BF54x
433 UART_SET_IER(uart, ETBEI); 404 UART_SET_IER(uart, ETBEI);
434#else
435 ier = UART_GET_IER(uart);
436 ier |= ETBEI;
437 UART_PUT_IER(uart, ier);
438#endif
439} 405}
440 406
441static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart) 407static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart)
@@ -513,19 +479,12 @@ static irqreturn_t bfin_serial_dma_tx_int(int irq, void *dev_id)
513{ 479{
514 struct bfin_serial_port *uart = dev_id; 480 struct bfin_serial_port *uart = dev_id;
515 struct circ_buf *xmit = &uart->port.info->xmit; 481 struct circ_buf *xmit = &uart->port.info->xmit;
516 unsigned short ier;
517 482
518 spin_lock(&uart->port.lock); 483 spin_lock(&uart->port.lock);
519 if (!(get_dma_curr_irqstat(uart->tx_dma_channel)&DMA_RUN)) { 484 if (!(get_dma_curr_irqstat(uart->tx_dma_channel)&DMA_RUN)) {
520 disable_dma(uart->tx_dma_channel); 485 disable_dma(uart->tx_dma_channel);
521 clear_dma_irqstat(uart->tx_dma_channel); 486 clear_dma_irqstat(uart->tx_dma_channel);
522#ifdef CONFIG_BF54x
523 UART_CLEAR_IER(uart, ETBEI); 487 UART_CLEAR_IER(uart, ETBEI);
524#else
525 ier = UART_GET_IER(uart);
526 ier &= ~ETBEI;
527 UART_PUT_IER(uart, ier);
528#endif
529 xmit->tail = (xmit->tail + uart->tx_count) & (UART_XMIT_SIZE - 1); 488 xmit->tail = (xmit->tail + uart->tx_count) & (UART_XMIT_SIZE - 1);
530 uart->port.icount.tx += uart->tx_count; 489 uart->port.icount.tx += uart->tx_count;
531 490
@@ -701,7 +660,6 @@ static int bfin_serial_startup(struct uart_port *port)
701# endif 660# endif
702 } 661 }
703 662
704
705 if (request_irq 663 if (request_irq
706 (uart->port.irq+1, bfin_serial_tx_int, IRQF_DISABLED, 664 (uart->port.irq+1, bfin_serial_tx_int, IRQF_DISABLED,
707 "BFIN_UART_TX", uart)) { 665 "BFIN_UART_TX", uart)) {
@@ -710,11 +668,7 @@ static int bfin_serial_startup(struct uart_port *port)
710 return -EBUSY; 668 return -EBUSY;
711 } 669 }
712#endif 670#endif
713#ifdef CONFIG_BF54x
714 UART_SET_IER(uart, ERBFI); 671 UART_SET_IER(uart, ERBFI);
715#else
716 UART_PUT_IER(uart, UART_GET_IER(uart) | ERBFI);
717#endif
718 return 0; 672 return 0;
719} 673}
720 674
@@ -1290,11 +1244,7 @@ static int __init bfin_serial_init(void)
1290 request_irq(uart->port.irq, bfin_serial_rx_int, 1244 request_irq(uart->port.irq, bfin_serial_rx_int,
1291 IRQF_DISABLED, "BFIN_UART_RX", uart); 1245 IRQF_DISABLED, "BFIN_UART_RX", uart);
1292 pr_info("Request irq for kgdb uart port\n"); 1246 pr_info("Request irq for kgdb uart port\n");
1293#ifdef CONFIG_BF54x
1294 UART_SET_IER(uart, ERBFI); 1247 UART_SET_IER(uart, ERBFI);
1295#else
1296 UART_PUT_IER(uart, UART_GET_IER(uart) | ERBFI);
1297#endif
1298 SSYNC(); 1248 SSYNC();
1299 t.c_cflag = CS8|B57600; 1249 t.c_cflag = CS8|B57600;
1300 t.c_iflag = 0; 1250 t.c_iflag = 0;