aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorMike Frysinger <vapier.adi@gmail.com>2008-05-06 23:41:26 -0400
committerBryan Wu <cooloney@kernel.org>2008-05-06 23:41:26 -0400
commit45828b812ddb608ddf83eff11601f62b726d13ab (patch)
tree462b7f1d8eb16da3700e285a9b9035037c9f5085 /drivers/serial
parent89bf6dc51ac7adb5a7d443648d9eb76909a1df8e (diff)
Blackfin Serial Driver: abstract away DLAB differences into header
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/bfin_5xx.c40
1 files changed, 7 insertions, 33 deletions
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c
index 869c99aa77a4..d6b4ead693b7 100644
--- a/drivers/serial/bfin_5xx.c
+++ b/drivers/serial/bfin_5xx.c
@@ -136,10 +136,7 @@ void kgdb_put_debug_char(int chr)
136 SSYNC(); 136 SSYNC();
137 } 137 }
138 138
139#ifndef CONFIG_BF54x 139 UART_CLEAR_DLAB(uart);
140 UART_PUT_LCR(uart, UART_GET_LCR(uart)&(~DLAB));
141 SSYNC();
142#endif
143 UART_PUT_CHAR(uart, (unsigned char)chr); 140 UART_PUT_CHAR(uart, (unsigned char)chr);
144 SSYNC(); 141 SSYNC();
145} 142}
@@ -158,10 +155,7 @@ int kgdb_get_debug_char(void)
158 while(!(UART_GET_LSR(uart) & DR)) { 155 while(!(UART_GET_LSR(uart) & DR)) {
159 SSYNC(); 156 SSYNC();
160 } 157 }
161#ifndef CONFIG_BF54x 158 UART_CLEAR_DLAB(uart);
162 UART_PUT_LCR(uart, UART_GET_LCR(uart)&(~DLAB));
163 SSYNC();
164#endif
165 chr = UART_GET_CHAR(uart); 159 chr = UART_GET_CHAR(uart);
166 SSYNC(); 160 SSYNC();
167 161
@@ -764,26 +758,15 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,
764 UART_PUT_IER(uart, 0); 758 UART_PUT_IER(uart, 0);
765#endif 759#endif
766 760
767#ifndef CONFIG_BF54x
768 /* Set DLAB in LCR to Access DLL and DLH */ 761 /* Set DLAB in LCR to Access DLL and DLH */
769 val = UART_GET_LCR(uart); 762 UART_SET_DLAB(uart);
770 val |= DLAB;
771 UART_PUT_LCR(uart, val);
772 SSYNC();
773#endif
774 763
775 UART_PUT_DLL(uart, quot & 0xFF); 764 UART_PUT_DLL(uart, quot & 0xFF);
776 SSYNC();
777 UART_PUT_DLH(uart, (quot >> 8) & 0xFF); 765 UART_PUT_DLH(uart, (quot >> 8) & 0xFF);
778 SSYNC(); 766 SSYNC();
779 767
780#ifndef CONFIG_BF54x
781 /* Clear DLAB in LCR to Access THR RBR IER */ 768 /* Clear DLAB in LCR to Access THR RBR IER */
782 val = UART_GET_LCR(uart); 769 UART_CLEAR_DLAB(uart);
783 val &= ~DLAB;
784 UART_PUT_LCR(uart, val);
785 SSYNC();
786#endif
787 770
788 UART_PUT_LCR(uart, lcr); 771 UART_PUT_LCR(uart, lcr);
789 772
@@ -946,8 +929,7 @@ bfin_serial_console_get_options(struct bfin_serial_port *uart, int *baud,
946 status = UART_GET_IER(uart) & (ERBFI | ETBEI); 929 status = UART_GET_IER(uart) & (ERBFI | ETBEI);
947 if (status == (ERBFI | ETBEI)) { 930 if (status == (ERBFI | ETBEI)) {
948 /* ok, the port was enabled */ 931 /* ok, the port was enabled */
949 unsigned short lcr, val; 932 u16 lcr, dlh, dll;
950 unsigned short dlh, dll;
951 933
952 lcr = UART_GET_LCR(uart); 934 lcr = UART_GET_LCR(uart);
953 935
@@ -964,22 +946,14 @@ bfin_serial_console_get_options(struct bfin_serial_port *uart, int *baud,
964 case 2: *bits = 7; break; 946 case 2: *bits = 7; break;
965 case 3: *bits = 8; break; 947 case 3: *bits = 8; break;
966 } 948 }
967#ifndef CONFIG_BF54x
968 /* Set DLAB in LCR to Access DLL and DLH */ 949 /* Set DLAB in LCR to Access DLL and DLH */
969 val = UART_GET_LCR(uart); 950 UART_SET_DLAB(uart);
970 val |= DLAB;
971 UART_PUT_LCR(uart, val);
972#endif
973 951
974 dll = UART_GET_DLL(uart); 952 dll = UART_GET_DLL(uart);
975 dlh = UART_GET_DLH(uart); 953 dlh = UART_GET_DLH(uart);
976 954
977#ifndef CONFIG_BF54x
978 /* Clear DLAB in LCR to Access THR RBR IER */ 955 /* Clear DLAB in LCR to Access THR RBR IER */
979 val = UART_GET_LCR(uart); 956 UART_CLEAR_DLAB(uart);
980 val &= ~DLAB;
981 UART_PUT_LCR(uart, val);
982#endif
983 957
984 *baud = get_sclk() / (16*(dll | dlh << 8)); 958 *baud = get_sclk() / (16*(dll | dlh << 8));
985 } 959 }