aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-05-09 13:34:00 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-05-09 13:34:00 -0400
commit3ed43c745d2ce0c4ca15ad406285d1cc7e8ceec3 (patch)
tree286decf836edc60ef70a0306a785ed497f7fed73 /drivers/serial
parent26c5e98e88a6126adef2ddce21899e5afe823a2b (diff)
parent45828b812ddb608ddf83eff11601f62b726d13ab (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/blackfin-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/blackfin-2.6: (21 commits) Blackfin Serial Driver: abstract away DLAB differences into header Blackfin Serial Driver: macro away the IER differences between processors [Blackfin] arch: remove useless IRQ_SW_INT defines [Blackfin] arch: protect linux/usb/musb.h include until the driver gets mainlined [Blackfin] arch: protect linux/usb/isp1362.h include until the driver gets mainlined [Blackfin] arch: add EBIU supporting for BF54x EZKIT SMSC LAN911x/LAN921x families embedded ethernet driver [Blackfin] arch: Set spi flash partition on bf527 as like bf548. [Blackfin] arch: fix bug - Remove module will not free L1 memory used [Blackfin] arch: fix wrong header name in comment [Blackfin] arch: Fix BUG - spi flash on bf527 ezkit would fail at mount [Blackfin] arch: add twi_lcd and twi_keypad i2c board info to bf527-ezkit [Blackfin] arch: Add physmap partition for BF527-EZkit [Blackfin] arch: fix gdb testing regression [Blackfin] arch: disable single stepping when delivering a signal [Blackfin] arch: Delete unused (copied from m68k) entries in asm-offsets.c. [Blackfin] arch: In the double fault handler, set up the PT_RETI slot [Blackfin] arch: Support for CPU_FREQ and NOHZ [Blackfin] arch: Functional power management support: Add CPU and platform voltage scaling support [Blackfin] arch: fix bug - breaking the atomic sections code. [Blackfin] arch: Equalize include files: Add VR_CTL masks ...
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/bfin_5xx.c98
1 files changed, 11 insertions, 87 deletions
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c
index 8a2f6a1baa74..d6b4ead693b7 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/*
@@ -161,10 +136,7 @@ void kgdb_put_debug_char(int chr)
161 SSYNC(); 136 SSYNC();
162 } 137 }
163 138
164#ifndef CONFIG_BF54x 139 UART_CLEAR_DLAB(uart);
165 UART_PUT_LCR(uart, UART_GET_LCR(uart)&(~DLAB));
166 SSYNC();
167#endif
168 UART_PUT_CHAR(uart, (unsigned char)chr); 140 UART_PUT_CHAR(uart, (unsigned char)chr);
169 SSYNC(); 141 SSYNC();
170} 142}
@@ -183,10 +155,7 @@ int kgdb_get_debug_char(void)
183 while(!(UART_GET_LSR(uart) & DR)) { 155 while(!(UART_GET_LSR(uart) & DR)) {
184 SSYNC(); 156 SSYNC();
185 } 157 }
186#ifndef CONFIG_BF54x 158 UART_CLEAR_DLAB(uart);
187 UART_PUT_LCR(uart, UART_GET_LCR(uart)&(~DLAB));
188 SSYNC();
189#endif
190 chr = UART_GET_CHAR(uart); 159 chr = UART_GET_CHAR(uart);
191 SSYNC(); 160 SSYNC();
192 161
@@ -208,9 +177,6 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
208 struct tty_struct *tty = uart->port.info->tty; 177 struct tty_struct *tty = uart->port.info->tty;
209 unsigned int status, ch, flg; 178 unsigned int status, ch, flg;
210 static struct timeval anomaly_start = { .tv_sec = 0 }; 179 static struct timeval anomaly_start = { .tv_sec = 0 };
211#ifdef CONFIG_KGDB_UART
212 struct pt_regs *regs = get_irq_regs();
213#endif
214 180
215 status = UART_GET_LSR(uart); 181 status = UART_GET_LSR(uart);
216 UART_CLEAR_LSR(uart); 182 UART_CLEAR_LSR(uart);
@@ -220,6 +186,7 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
220 186
221#ifdef CONFIG_KGDB_UART 187#ifdef CONFIG_KGDB_UART
222 if (uart->port.line == CONFIG_KGDB_UART_PORT) { 188 if (uart->port.line == CONFIG_KGDB_UART_PORT) {
189 struct pt_regs *regs = get_irq_regs();
223 if (uart->port.cons->index == CONFIG_KGDB_UART_PORT && ch == 0x1) { /* Ctrl + A */ 190 if (uart->port.cons->index == CONFIG_KGDB_UART_PORT && ch == 0x1) { /* Ctrl + A */
224 kgdb_breakkey_pressed(regs); 191 kgdb_breakkey_pressed(regs);
225 return; 192 return;
@@ -391,7 +358,6 @@ static void bfin_serial_do_work(struct work_struct *work)
391static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart) 358static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart)
392{ 359{
393 struct circ_buf *xmit = &uart->port.info->xmit; 360 struct circ_buf *xmit = &uart->port.info->xmit;
394 unsigned short ier;
395 361
396 uart->tx_done = 0; 362 uart->tx_done = 0;
397 363
@@ -429,13 +395,7 @@ static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart)
429 set_dma_x_modify(uart->tx_dma_channel, 1); 395 set_dma_x_modify(uart->tx_dma_channel, 1);
430 enable_dma(uart->tx_dma_channel); 396 enable_dma(uart->tx_dma_channel);
431 397
432#ifdef CONFIG_BF54x
433 UART_SET_IER(uart, ETBEI); 398 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} 399}
440 400
441static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart) 401static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart)
@@ -513,19 +473,12 @@ static irqreturn_t bfin_serial_dma_tx_int(int irq, void *dev_id)
513{ 473{
514 struct bfin_serial_port *uart = dev_id; 474 struct bfin_serial_port *uart = dev_id;
515 struct circ_buf *xmit = &uart->port.info->xmit; 475 struct circ_buf *xmit = &uart->port.info->xmit;
516 unsigned short ier;
517 476
518 spin_lock(&uart->port.lock); 477 spin_lock(&uart->port.lock);
519 if (!(get_dma_curr_irqstat(uart->tx_dma_channel)&DMA_RUN)) { 478 if (!(get_dma_curr_irqstat(uart->tx_dma_channel)&DMA_RUN)) {
520 disable_dma(uart->tx_dma_channel); 479 disable_dma(uart->tx_dma_channel);
521 clear_dma_irqstat(uart->tx_dma_channel); 480 clear_dma_irqstat(uart->tx_dma_channel);
522#ifdef CONFIG_BF54x
523 UART_CLEAR_IER(uart, ETBEI); 481 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); 482 xmit->tail = (xmit->tail + uart->tx_count) & (UART_XMIT_SIZE - 1);
530 uart->port.icount.tx += uart->tx_count; 483 uart->port.icount.tx += uart->tx_count;
531 484
@@ -701,7 +654,6 @@ static int bfin_serial_startup(struct uart_port *port)
701# endif 654# endif
702 } 655 }
703 656
704
705 if (request_irq 657 if (request_irq
706 (uart->port.irq+1, bfin_serial_tx_int, IRQF_DISABLED, 658 (uart->port.irq+1, bfin_serial_tx_int, IRQF_DISABLED,
707 "BFIN_UART_TX", uart)) { 659 "BFIN_UART_TX", uart)) {
@@ -710,11 +662,7 @@ static int bfin_serial_startup(struct uart_port *port)
710 return -EBUSY; 662 return -EBUSY;
711 } 663 }
712#endif 664#endif
713#ifdef CONFIG_BF54x
714 UART_SET_IER(uart, ERBFI); 665 UART_SET_IER(uart, ERBFI);
715#else
716 UART_PUT_IER(uart, UART_GET_IER(uart) | ERBFI);
717#endif
718 return 0; 666 return 0;
719} 667}
720 668
@@ -810,26 +758,15 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,
810 UART_PUT_IER(uart, 0); 758 UART_PUT_IER(uart, 0);
811#endif 759#endif
812 760
813#ifndef CONFIG_BF54x
814 /* Set DLAB in LCR to Access DLL and DLH */ 761 /* Set DLAB in LCR to Access DLL and DLH */
815 val = UART_GET_LCR(uart); 762 UART_SET_DLAB(uart);
816 val |= DLAB;
817 UART_PUT_LCR(uart, val);
818 SSYNC();
819#endif
820 763
821 UART_PUT_DLL(uart, quot & 0xFF); 764 UART_PUT_DLL(uart, quot & 0xFF);
822 SSYNC();
823 UART_PUT_DLH(uart, (quot >> 8) & 0xFF); 765 UART_PUT_DLH(uart, (quot >> 8) & 0xFF);
824 SSYNC(); 766 SSYNC();
825 767
826#ifndef CONFIG_BF54x
827 /* Clear DLAB in LCR to Access THR RBR IER */ 768 /* Clear DLAB in LCR to Access THR RBR IER */
828 val = UART_GET_LCR(uart); 769 UART_CLEAR_DLAB(uart);
829 val &= ~DLAB;
830 UART_PUT_LCR(uart, val);
831 SSYNC();
832#endif
833 770
834 UART_PUT_LCR(uart, lcr); 771 UART_PUT_LCR(uart, lcr);
835 772
@@ -992,8 +929,7 @@ bfin_serial_console_get_options(struct bfin_serial_port *uart, int *baud,
992 status = UART_GET_IER(uart) & (ERBFI | ETBEI); 929 status = UART_GET_IER(uart) & (ERBFI | ETBEI);
993 if (status == (ERBFI | ETBEI)) { 930 if (status == (ERBFI | ETBEI)) {
994 /* ok, the port was enabled */ 931 /* ok, the port was enabled */
995 unsigned short lcr, val; 932 u16 lcr, dlh, dll;
996 unsigned short dlh, dll;
997 933
998 lcr = UART_GET_LCR(uart); 934 lcr = UART_GET_LCR(uart);
999 935
@@ -1010,22 +946,14 @@ bfin_serial_console_get_options(struct bfin_serial_port *uart, int *baud,
1010 case 2: *bits = 7; break; 946 case 2: *bits = 7; break;
1011 case 3: *bits = 8; break; 947 case 3: *bits = 8; break;
1012 } 948 }
1013#ifndef CONFIG_BF54x
1014 /* Set DLAB in LCR to Access DLL and DLH */ 949 /* Set DLAB in LCR to Access DLL and DLH */
1015 val = UART_GET_LCR(uart); 950 UART_SET_DLAB(uart);
1016 val |= DLAB;
1017 UART_PUT_LCR(uart, val);
1018#endif
1019 951
1020 dll = UART_GET_DLL(uart); 952 dll = UART_GET_DLL(uart);
1021 dlh = UART_GET_DLH(uart); 953 dlh = UART_GET_DLH(uart);
1022 954
1023#ifndef CONFIG_BF54x
1024 /* Clear DLAB in LCR to Access THR RBR IER */ 955 /* Clear DLAB in LCR to Access THR RBR IER */
1025 val = UART_GET_LCR(uart); 956 UART_CLEAR_DLAB(uart);
1026 val &= ~DLAB;
1027 UART_PUT_LCR(uart, val);
1028#endif
1029 957
1030 *baud = get_sclk() / (16*(dll | dlh << 8)); 958 *baud = get_sclk() / (16*(dll | dlh << 8));
1031 } 959 }
@@ -1290,11 +1218,7 @@ static int __init bfin_serial_init(void)
1290 request_irq(uart->port.irq, bfin_serial_rx_int, 1218 request_irq(uart->port.irq, bfin_serial_rx_int,
1291 IRQF_DISABLED, "BFIN_UART_RX", uart); 1219 IRQF_DISABLED, "BFIN_UART_RX", uart);
1292 pr_info("Request irq for kgdb uart port\n"); 1220 pr_info("Request irq for kgdb uart port\n");
1293#ifdef CONFIG_BF54x
1294 UART_SET_IER(uart, ERBFI); 1221 UART_SET_IER(uart, ERBFI);
1295#else
1296 UART_PUT_IER(uart, UART_GET_IER(uart) | ERBFI);
1297#endif
1298 SSYNC(); 1222 SSYNC();
1299 t.c_cflag = CS8|B57600; 1223 t.c_cflag = CS8|B57600;
1300 t.c_iflag = 0; 1224 t.c_iflag = 0;