aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@nokia.com>2010-11-30 17:11:49 -0500
committerTony Lindgren <tony@atomide.com>2010-11-30 17:11:49 -0500
commit662b083a87a3489f3f19c6e0651c1b99b0de5df0 (patch)
tree67c7ba4784a1099f404c42ba1496c3078fa4af71
parent498cb95175c29ed96bf32f30df2d11ec1c7f3879 (diff)
omap: Serial: Define register access modes in LCR
Access to some registers depends on register access mode Three different modes are available for OMAP (at least) • Operational mode LCR_REG[7] = 0x0 • Configuration mode A LCR_REG[7] = 0x1 and LCR_REG[7:0]! = 0xBF • Configuration mode B LCR_REG[7] = 0x1 and LCR_REG[7:0] = 0xBF Define access modes and remove redefinitions and magic numbers in serial drivers (and later in bluetooth driver). Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@nokia.com> Acked-by: Govindraj.R <govindraj.raja@ti.com> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r--arch/arm/mach-omap2/serial.c12
-rw-r--r--arch/arm/plat-omap/include/plat/omap-serial.h9
-rw-r--r--drivers/serial/8250.c26
-rw-r--r--drivers/serial/omap-serial.c34
-rw-r--r--include/linux/serial_reg.h7
5 files changed, 43 insertions, 45 deletions
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index fa9806250b50..9dc077e2d8af 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -219,7 +219,7 @@ static void omap_uart_save_context(struct omap_uart_state *uart)
219 return; 219 return;
220 220
221 lcr = serial_read_reg(uart, UART_LCR); 221 lcr = serial_read_reg(uart, UART_LCR);
222 serial_write_reg(uart, UART_LCR, 0xBF); 222 serial_write_reg(uart, UART_LCR, UART_LCR_CONF_MODE_B);
223 uart->dll = serial_read_reg(uart, UART_DLL); 223 uart->dll = serial_read_reg(uart, UART_DLL);
224 uart->dlh = serial_read_reg(uart, UART_DLM); 224 uart->dlh = serial_read_reg(uart, UART_DLM);
225 serial_write_reg(uart, UART_LCR, lcr); 225 serial_write_reg(uart, UART_LCR, lcr);
@@ -227,7 +227,7 @@ static void omap_uart_save_context(struct omap_uart_state *uart)
227 uart->sysc = serial_read_reg(uart, UART_OMAP_SYSC); 227 uart->sysc = serial_read_reg(uart, UART_OMAP_SYSC);
228 uart->scr = serial_read_reg(uart, UART_OMAP_SCR); 228 uart->scr = serial_read_reg(uart, UART_OMAP_SCR);
229 uart->wer = serial_read_reg(uart, UART_OMAP_WER); 229 uart->wer = serial_read_reg(uart, UART_OMAP_WER);
230 serial_write_reg(uart, UART_LCR, 0x80); 230 serial_write_reg(uart, UART_LCR, UART_LCR_CONF_MODE_A);
231 uart->mcr = serial_read_reg(uart, UART_MCR); 231 uart->mcr = serial_read_reg(uart, UART_MCR);
232 serial_write_reg(uart, UART_LCR, lcr); 232 serial_write_reg(uart, UART_LCR, lcr);
233 233
@@ -251,19 +251,19 @@ static void omap_uart_restore_context(struct omap_uart_state *uart)
251 else 251 else
252 serial_write_reg(uart, UART_OMAP_MDR1, UART_OMAP_MDR1_DISABLE); 252 serial_write_reg(uart, UART_OMAP_MDR1, UART_OMAP_MDR1_DISABLE);
253 253
254 serial_write_reg(uart, UART_LCR, 0xBF); /* Config B mode */ 254 serial_write_reg(uart, UART_LCR, UART_LCR_CONF_MODE_B);
255 efr = serial_read_reg(uart, UART_EFR); 255 efr = serial_read_reg(uart, UART_EFR);
256 serial_write_reg(uart, UART_EFR, UART_EFR_ECB); 256 serial_write_reg(uart, UART_EFR, UART_EFR_ECB);
257 serial_write_reg(uart, UART_LCR, 0x0); /* Operational mode */ 257 serial_write_reg(uart, UART_LCR, 0x0); /* Operational mode */
258 serial_write_reg(uart, UART_IER, 0x0); 258 serial_write_reg(uart, UART_IER, 0x0);
259 serial_write_reg(uart, UART_LCR, 0xBF); /* Config B mode */ 259 serial_write_reg(uart, UART_LCR, UART_LCR_CONF_MODE_B);
260 serial_write_reg(uart, UART_DLL, uart->dll); 260 serial_write_reg(uart, UART_DLL, uart->dll);
261 serial_write_reg(uart, UART_DLM, uart->dlh); 261 serial_write_reg(uart, UART_DLM, uart->dlh);
262 serial_write_reg(uart, UART_LCR, 0x0); /* Operational mode */ 262 serial_write_reg(uart, UART_LCR, 0x0); /* Operational mode */
263 serial_write_reg(uart, UART_IER, uart->ier); 263 serial_write_reg(uart, UART_IER, uart->ier);
264 serial_write_reg(uart, UART_LCR, 0x80); 264 serial_write_reg(uart, UART_LCR, UART_LCR_CONF_MODE_A);
265 serial_write_reg(uart, UART_MCR, uart->mcr); 265 serial_write_reg(uart, UART_MCR, uart->mcr);
266 serial_write_reg(uart, UART_LCR, 0xBF); /* Config B mode */ 266 serial_write_reg(uart, UART_LCR, UART_LCR_CONF_MODE_B);
267 serial_write_reg(uart, UART_EFR, efr); 267 serial_write_reg(uart, UART_EFR, efr);
268 serial_write_reg(uart, UART_LCR, UART_LCR_WLEN8); 268 serial_write_reg(uart, UART_LCR, UART_LCR_WLEN8);
269 serial_write_reg(uart, UART_OMAP_SCR, uart->scr); 269 serial_write_reg(uart, UART_OMAP_SCR, uart->scr);
diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h
index 6a1788014611..b3e0bad9b77e 100644
--- a/arch/arm/plat-omap/include/plat/omap-serial.h
+++ b/arch/arm/plat-omap/include/plat/omap-serial.h
@@ -33,15 +33,6 @@
33 33
34#define OMAP_MODE13X_SPEED 230400 34#define OMAP_MODE13X_SPEED 230400
35 35
36/*
37 * LCR = 0XBF: Switch to Configuration Mode B.
38 * In configuration mode b allow access
39 * to EFR,DLL,DLH.
40 * Reference OMAP TRM Chapter 17
41 * Section: 1.4.3 Mode Selection
42 */
43#define OMAP_UART_LCR_CONF_MDB 0XBF
44
45/* WER = 0x7F 36/* WER = 0x7F
46 * Enable module level wakeup in WER reg 37 * Enable module level wakeup in WER reg
47 */ 38 */
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 4d8e14b7aa93..aaf9907e6014 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -653,13 +653,13 @@ static void serial8250_set_sleep(struct uart_8250_port *p, int sleep)
653{ 653{
654 if (p->capabilities & UART_CAP_SLEEP) { 654 if (p->capabilities & UART_CAP_SLEEP) {
655 if (p->capabilities & UART_CAP_EFR) { 655 if (p->capabilities & UART_CAP_EFR) {
656 serial_outp(p, UART_LCR, 0xBF); 656 serial_outp(p, UART_LCR, UART_LCR_CONF_MODE_B);
657 serial_outp(p, UART_EFR, UART_EFR_ECB); 657 serial_outp(p, UART_EFR, UART_EFR_ECB);
658 serial_outp(p, UART_LCR, 0); 658 serial_outp(p, UART_LCR, 0);
659 } 659 }
660 serial_outp(p, UART_IER, sleep ? UART_IERX_SLEEP : 0); 660 serial_outp(p, UART_IER, sleep ? UART_IERX_SLEEP : 0);
661 if (p->capabilities & UART_CAP_EFR) { 661 if (p->capabilities & UART_CAP_EFR) {
662 serial_outp(p, UART_LCR, 0xBF); 662 serial_outp(p, UART_LCR, UART_LCR_CONF_MODE_B);
663 serial_outp(p, UART_EFR, 0); 663 serial_outp(p, UART_EFR, 0);
664 serial_outp(p, UART_LCR, 0); 664 serial_outp(p, UART_LCR, 0);
665 } 665 }
@@ -752,7 +752,7 @@ static int size_fifo(struct uart_8250_port *up)
752 serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO | 752 serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO |
753 UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT); 753 UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT);
754 serial_outp(up, UART_MCR, UART_MCR_LOOP); 754 serial_outp(up, UART_MCR, UART_MCR_LOOP);
755 serial_outp(up, UART_LCR, UART_LCR_DLAB); 755 serial_outp(up, UART_LCR, UART_LCR_CONF_MODE_A);
756 old_dl = serial_dl_read(up); 756 old_dl = serial_dl_read(up);
757 serial_dl_write(up, 0x0001); 757 serial_dl_write(up, 0x0001);
758 serial_outp(up, UART_LCR, 0x03); 758 serial_outp(up, UART_LCR, 0x03);
@@ -764,7 +764,7 @@ static int size_fifo(struct uart_8250_port *up)
764 serial_inp(up, UART_RX); 764 serial_inp(up, UART_RX);
765 serial_outp(up, UART_FCR, old_fcr); 765 serial_outp(up, UART_FCR, old_fcr);
766 serial_outp(up, UART_MCR, old_mcr); 766 serial_outp(up, UART_MCR, old_mcr);
767 serial_outp(up, UART_LCR, UART_LCR_DLAB); 767 serial_outp(up, UART_LCR, UART_LCR_CONF_MODE_A);
768 serial_dl_write(up, old_dl); 768 serial_dl_write(up, old_dl);
769 serial_outp(up, UART_LCR, old_lcr); 769 serial_outp(up, UART_LCR, old_lcr);
770 770
@@ -782,7 +782,7 @@ static unsigned int autoconfig_read_divisor_id(struct uart_8250_port *p)
782 unsigned int id; 782 unsigned int id;
783 783
784 old_lcr = serial_inp(p, UART_LCR); 784 old_lcr = serial_inp(p, UART_LCR);
785 serial_outp(p, UART_LCR, UART_LCR_DLAB); 785 serial_outp(p, UART_LCR, UART_LCR_CONF_MODE_A);
786 786
787 old_dll = serial_inp(p, UART_DLL); 787 old_dll = serial_inp(p, UART_DLL);
788 old_dlm = serial_inp(p, UART_DLM); 788 old_dlm = serial_inp(p, UART_DLM);
@@ -836,7 +836,7 @@ static void autoconfig_has_efr(struct uart_8250_port *up)
836 * recommended for new designs). 836 * recommended for new designs).
837 */ 837 */
838 up->acr = 0; 838 up->acr = 0;
839 serial_out(up, UART_LCR, 0xBF); 839 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B);
840 serial_out(up, UART_EFR, UART_EFR_ECB); 840 serial_out(up, UART_EFR, UART_EFR_ECB);
841 serial_out(up, UART_LCR, 0x00); 841 serial_out(up, UART_LCR, 0x00);
842 id1 = serial_icr_read(up, UART_ID1); 842 id1 = serial_icr_read(up, UART_ID1);
@@ -945,7 +945,7 @@ static void autoconfig_16550a(struct uart_8250_port *up)
945 * Check for presence of the EFR when DLAB is set. 945 * Check for presence of the EFR when DLAB is set.
946 * Only ST16C650V1 UARTs pass this test. 946 * Only ST16C650V1 UARTs pass this test.
947 */ 947 */
948 serial_outp(up, UART_LCR, UART_LCR_DLAB); 948 serial_outp(up, UART_LCR, UART_LCR_CONF_MODE_A);
949 if (serial_in(up, UART_EFR) == 0) { 949 if (serial_in(up, UART_EFR) == 0) {
950 serial_outp(up, UART_EFR, 0xA8); 950 serial_outp(up, UART_EFR, 0xA8);
951 if (serial_in(up, UART_EFR) != 0) { 951 if (serial_in(up, UART_EFR) != 0) {
@@ -963,7 +963,7 @@ static void autoconfig_16550a(struct uart_8250_port *up)
963 * Maybe it requires 0xbf to be written to the LCR. 963 * Maybe it requires 0xbf to be written to the LCR.
964 * (other ST16C650V2 UARTs, TI16C752A, etc) 964 * (other ST16C650V2 UARTs, TI16C752A, etc)
965 */ 965 */
966 serial_outp(up, UART_LCR, 0xBF); 966 serial_outp(up, UART_LCR, UART_LCR_CONF_MODE_B);
967 if (serial_in(up, UART_EFR) == 0 && !broken_efr(up)) { 967 if (serial_in(up, UART_EFR) == 0 && !broken_efr(up)) {
968 DEBUG_AUTOCONF("EFRv2 "); 968 DEBUG_AUTOCONF("EFRv2 ");
969 autoconfig_has_efr(up); 969 autoconfig_has_efr(up);
@@ -1024,7 +1024,7 @@ static void autoconfig_16550a(struct uart_8250_port *up)
1024 serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO | UART_FCR7_64BYTE); 1024 serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO | UART_FCR7_64BYTE);
1025 status1 = serial_in(up, UART_IIR) >> 5; 1025 status1 = serial_in(up, UART_IIR) >> 5;
1026 serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO); 1026 serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO);
1027 serial_outp(up, UART_LCR, UART_LCR_DLAB); 1027 serial_outp(up, UART_LCR, UART_LCR_CONF_MODE_A);
1028 serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO | UART_FCR7_64BYTE); 1028 serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO | UART_FCR7_64BYTE);
1029 status2 = serial_in(up, UART_IIR) >> 5; 1029 status2 = serial_in(up, UART_IIR) >> 5;
1030 serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO); 1030 serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO);
@@ -1183,7 +1183,7 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
1183 * We also initialise the EFR (if any) to zero for later. The 1183 * We also initialise the EFR (if any) to zero for later. The
1184 * EFR occupies the same register location as the FCR and IIR. 1184 * EFR occupies the same register location as the FCR and IIR.
1185 */ 1185 */
1186 serial_outp(up, UART_LCR, 0xBF); 1186 serial_outp(up, UART_LCR, UART_LCR_CONF_MODE_B);
1187 serial_outp(up, UART_EFR, 0); 1187 serial_outp(up, UART_EFR, 0);
1188 serial_outp(up, UART_LCR, 0); 1188 serial_outp(up, UART_LCR, 0);
1189 1189
@@ -1952,7 +1952,7 @@ static int serial8250_startup(struct uart_port *port)
1952 if (up->port.type == PORT_16C950) { 1952 if (up->port.type == PORT_16C950) {
1953 /* Wake up and initialize UART */ 1953 /* Wake up and initialize UART */
1954 up->acr = 0; 1954 up->acr = 0;
1955 serial_outp(up, UART_LCR, 0xBF); 1955 serial_outp(up, UART_LCR, UART_LCR_CONF_MODE_B);
1956 serial_outp(up, UART_EFR, UART_EFR_ECB); 1956 serial_outp(up, UART_EFR, UART_EFR_ECB);
1957 serial_outp(up, UART_IER, 0); 1957 serial_outp(up, UART_IER, 0);
1958 serial_outp(up, UART_LCR, 0); 1958 serial_outp(up, UART_LCR, 0);
@@ -2002,7 +2002,7 @@ static int serial8250_startup(struct uart_port *port)
2002 if (up->port.type == PORT_16850) { 2002 if (up->port.type == PORT_16850) {
2003 unsigned char fctr; 2003 unsigned char fctr;
2004 2004
2005 serial_outp(up, UART_LCR, 0xbf); 2005 serial_outp(up, UART_LCR, UART_LCR_CONF_MODE_B);
2006 2006
2007 fctr = serial_inp(up, UART_FCTR) & ~(UART_FCTR_RX|UART_FCTR_TX); 2007 fctr = serial_inp(up, UART_FCTR) & ~(UART_FCTR_RX|UART_FCTR_TX);
2008 serial_outp(up, UART_FCTR, fctr | UART_FCTR_TRGD | UART_FCTR_RX); 2008 serial_outp(up, UART_FCTR, fctr | UART_FCTR_TRGD | UART_FCTR_RX);
@@ -2363,7 +2363,7 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios,
2363 if (termios->c_cflag & CRTSCTS) 2363 if (termios->c_cflag & CRTSCTS)
2364 efr |= UART_EFR_CTS; 2364 efr |= UART_EFR_CTS;
2365 2365
2366 serial_outp(up, UART_LCR, 0xBF); 2366 serial_outp(up, UART_LCR, UART_LCR_CONF_MODE_B);
2367 serial_outp(up, UART_EFR, efr); 2367 serial_outp(up, UART_EFR, efr);
2368 } 2368 }
2369 2369
diff --git a/drivers/serial/omap-serial.c b/drivers/serial/omap-serial.c
index 03a96db67de4..1201eff1831e 100644
--- a/drivers/serial/omap-serial.c
+++ b/drivers/serial/omap-serial.c
@@ -570,7 +570,7 @@ serial_omap_configure_xonxoff
570 unsigned char efr = 0; 570 unsigned char efr = 0;
571 571
572 up->lcr = serial_in(up, UART_LCR); 572 up->lcr = serial_in(up, UART_LCR);
573 serial_out(up, UART_LCR, OMAP_UART_LCR_CONF_MDB); 573 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B);
574 up->efr = serial_in(up, UART_EFR); 574 up->efr = serial_in(up, UART_EFR);
575 serial_out(up, UART_EFR, up->efr & ~UART_EFR_ECB); 575 serial_out(up, UART_EFR, up->efr & ~UART_EFR_ECB);
576 576
@@ -598,7 +598,7 @@ serial_omap_configure_xonxoff
598 efr |= OMAP_UART_SW_RX; 598 efr |= OMAP_UART_SW_RX;
599 599
600 serial_out(up, UART_EFR, up->efr | UART_EFR_ECB); 600 serial_out(up, UART_EFR, up->efr | UART_EFR_ECB);
601 serial_out(up, UART_LCR, UART_LCR_DLAB); 601 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_A);
602 602
603 up->mcr = serial_in(up, UART_MCR); 603 up->mcr = serial_in(up, UART_MCR);
604 604
@@ -612,14 +612,14 @@ serial_omap_configure_xonxoff
612 up->mcr |= UART_MCR_XONANY; 612 up->mcr |= UART_MCR_XONANY;
613 613
614 serial_out(up, UART_MCR, up->mcr | UART_MCR_TCRTLR); 614 serial_out(up, UART_MCR, up->mcr | UART_MCR_TCRTLR);
615 serial_out(up, UART_LCR, OMAP_UART_LCR_CONF_MDB); 615 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B);
616 serial_out(up, UART_TI752_TCR, OMAP_UART_TCR_TRIG); 616 serial_out(up, UART_TI752_TCR, OMAP_UART_TCR_TRIG);
617 /* Enable special char function UARTi.EFR_REG[5] and 617 /* Enable special char function UARTi.EFR_REG[5] and
618 * load the new software flow control mode IXON or IXOFF 618 * load the new software flow control mode IXON or IXOFF
619 * and restore the UARTi.EFR_REG[4] ENHANCED_EN value. 619 * and restore the UARTi.EFR_REG[4] ENHANCED_EN value.
620 */ 620 */
621 serial_out(up, UART_EFR, efr | UART_EFR_SCD); 621 serial_out(up, UART_EFR, efr | UART_EFR_SCD);
622 serial_out(up, UART_LCR, UART_LCR_DLAB); 622 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_A);
623 623
624 serial_out(up, UART_MCR, up->mcr & ~UART_MCR_TCRTLR); 624 serial_out(up, UART_MCR, up->mcr & ~UART_MCR_TCRTLR);
625 serial_out(up, UART_LCR, up->lcr); 625 serial_out(up, UART_LCR, up->lcr);
@@ -724,22 +724,22 @@ serial_omap_set_termios(struct uart_port *port, struct ktermios *termios,
724 * baud clock is not running 724 * baud clock is not running
725 * DLL_REG and DLH_REG set to 0. 725 * DLL_REG and DLH_REG set to 0.
726 */ 726 */
727 serial_out(up, UART_LCR, UART_LCR_DLAB); 727 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_A);
728 serial_out(up, UART_DLL, 0); 728 serial_out(up, UART_DLL, 0);
729 serial_out(up, UART_DLM, 0); 729 serial_out(up, UART_DLM, 0);
730 serial_out(up, UART_LCR, 0); 730 serial_out(up, UART_LCR, 0);
731 731
732 serial_out(up, UART_LCR, OMAP_UART_LCR_CONF_MDB); 732 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B);
733 733
734 up->efr = serial_in(up, UART_EFR); 734 up->efr = serial_in(up, UART_EFR);
735 serial_out(up, UART_EFR, up->efr | UART_EFR_ECB); 735 serial_out(up, UART_EFR, up->efr | UART_EFR_ECB);
736 736
737 serial_out(up, UART_LCR, UART_LCR_DLAB); 737 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_A);
738 up->mcr = serial_in(up, UART_MCR); 738 up->mcr = serial_in(up, UART_MCR);
739 serial_out(up, UART_MCR, up->mcr | UART_MCR_TCRTLR); 739 serial_out(up, UART_MCR, up->mcr | UART_MCR_TCRTLR);
740 /* FIFO ENABLE, DMA MODE */ 740 /* FIFO ENABLE, DMA MODE */
741 serial_out(up, UART_FCR, up->fcr); 741 serial_out(up, UART_FCR, up->fcr);
742 serial_out(up, UART_LCR, OMAP_UART_LCR_CONF_MDB); 742 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B);
743 743
744 if (up->use_dma) { 744 if (up->use_dma) {
745 serial_out(up, UART_TI752_TLR, 0); 745 serial_out(up, UART_TI752_TLR, 0);
@@ -748,27 +748,27 @@ serial_omap_set_termios(struct uart_port *port, struct ktermios *termios,
748 } 748 }
749 749
750 serial_out(up, UART_EFR, up->efr); 750 serial_out(up, UART_EFR, up->efr);
751 serial_out(up, UART_LCR, UART_LCR_DLAB); 751 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_A);
752 serial_out(up, UART_MCR, up->mcr); 752 serial_out(up, UART_MCR, up->mcr);
753 753
754 /* Protocol, Baud Rate, and Interrupt Settings */ 754 /* Protocol, Baud Rate, and Interrupt Settings */
755 755
756 serial_out(up, UART_OMAP_MDR1, UART_OMAP_MDR1_DISABLE); 756 serial_out(up, UART_OMAP_MDR1, UART_OMAP_MDR1_DISABLE);
757 serial_out(up, UART_LCR, OMAP_UART_LCR_CONF_MDB); 757 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B);
758 758
759 up->efr = serial_in(up, UART_EFR); 759 up->efr = serial_in(up, UART_EFR);
760 serial_out(up, UART_EFR, up->efr | UART_EFR_ECB); 760 serial_out(up, UART_EFR, up->efr | UART_EFR_ECB);
761 761
762 serial_out(up, UART_LCR, 0); 762 serial_out(up, UART_LCR, 0);
763 serial_out(up, UART_IER, 0); 763 serial_out(up, UART_IER, 0);
764 serial_out(up, UART_LCR, OMAP_UART_LCR_CONF_MDB); 764 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B);
765 765
766 serial_out(up, UART_DLL, quot & 0xff); /* LS of divisor */ 766 serial_out(up, UART_DLL, quot & 0xff); /* LS of divisor */
767 serial_out(up, UART_DLM, quot >> 8); /* MS of divisor */ 767 serial_out(up, UART_DLM, quot >> 8); /* MS of divisor */
768 768
769 serial_out(up, UART_LCR, 0); 769 serial_out(up, UART_LCR, 0);
770 serial_out(up, UART_IER, up->ier); 770 serial_out(up, UART_IER, up->ier);
771 serial_out(up, UART_LCR, OMAP_UART_LCR_CONF_MDB); 771 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B);
772 772
773 serial_out(up, UART_EFR, up->efr); 773 serial_out(up, UART_EFR, up->efr);
774 serial_out(up, UART_LCR, cval); 774 serial_out(up, UART_LCR, cval);
@@ -782,18 +782,18 @@ serial_omap_set_termios(struct uart_port *port, struct ktermios *termios,
782 782
783 if (termios->c_cflag & CRTSCTS) { 783 if (termios->c_cflag & CRTSCTS) {
784 efr |= (UART_EFR_CTS | UART_EFR_RTS); 784 efr |= (UART_EFR_CTS | UART_EFR_RTS);
785 serial_out(up, UART_LCR, UART_LCR_DLAB); 785 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_A);
786 786
787 up->mcr = serial_in(up, UART_MCR); 787 up->mcr = serial_in(up, UART_MCR);
788 serial_out(up, UART_MCR, up->mcr | UART_MCR_TCRTLR); 788 serial_out(up, UART_MCR, up->mcr | UART_MCR_TCRTLR);
789 789
790 serial_out(up, UART_LCR, OMAP_UART_LCR_CONF_MDB); 790 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B);
791 up->efr = serial_in(up, UART_EFR); 791 up->efr = serial_in(up, UART_EFR);
792 serial_out(up, UART_EFR, up->efr | UART_EFR_ECB); 792 serial_out(up, UART_EFR, up->efr | UART_EFR_ECB);
793 793
794 serial_out(up, UART_TI752_TCR, OMAP_UART_TCR_TRIG); 794 serial_out(up, UART_TI752_TCR, OMAP_UART_TCR_TRIG);
795 serial_out(up, UART_EFR, efr); /* Enable AUTORTS and AUTOCTS */ 795 serial_out(up, UART_EFR, efr); /* Enable AUTORTS and AUTOCTS */
796 serial_out(up, UART_LCR, UART_LCR_DLAB); 796 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_A);
797 serial_out(up, UART_MCR, up->mcr | UART_MCR_RTS); 797 serial_out(up, UART_MCR, up->mcr | UART_MCR_RTS);
798 serial_out(up, UART_LCR, cval); 798 serial_out(up, UART_LCR, cval);
799 } 799 }
@@ -815,13 +815,13 @@ serial_omap_pm(struct uart_port *port, unsigned int state,
815 unsigned char efr; 815 unsigned char efr;
816 816
817 dev_dbg(up->port.dev, "serial_omap_pm+%d\n", up->pdev->id); 817 dev_dbg(up->port.dev, "serial_omap_pm+%d\n", up->pdev->id);
818 serial_out(up, UART_LCR, OMAP_UART_LCR_CONF_MDB); 818 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B);
819 efr = serial_in(up, UART_EFR); 819 efr = serial_in(up, UART_EFR);
820 serial_out(up, UART_EFR, efr | UART_EFR_ECB); 820 serial_out(up, UART_EFR, efr | UART_EFR_ECB);
821 serial_out(up, UART_LCR, 0); 821 serial_out(up, UART_LCR, 0);
822 822
823 serial_out(up, UART_IER, (state != 0) ? UART_IERX_SLEEP : 0); 823 serial_out(up, UART_IER, (state != 0) ? UART_IERX_SLEEP : 0);
824 serial_out(up, UART_LCR, OMAP_UART_LCR_CONF_MDB); 824 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B);
825 serial_out(up, UART_EFR, efr); 825 serial_out(up, UART_EFR, efr);
826 serial_out(up, UART_LCR, 0); 826 serial_out(up, UART_LCR, 0);
827 /* Enable module level wake up */ 827 /* Enable module level wake up */
diff --git a/include/linux/serial_reg.h b/include/linux/serial_reg.h
index 6f3823474e6c..3ecb71a9e505 100644
--- a/include/linux/serial_reg.h
+++ b/include/linux/serial_reg.h
@@ -99,6 +99,13 @@
99#define UART_LCR_WLEN7 0x02 /* Wordlength: 7 bits */ 99#define UART_LCR_WLEN7 0x02 /* Wordlength: 7 bits */
100#define UART_LCR_WLEN8 0x03 /* Wordlength: 8 bits */ 100#define UART_LCR_WLEN8 0x03 /* Wordlength: 8 bits */
101 101
102/*
103 * Access to some registers depends on register access / configuration
104 * mode.
105 */
106#define UART_LCR_CONF_MODE_A UART_LCR_DLAB /* Configutation mode A */
107#define UART_LCR_CONF_MODE_B 0xBF /* Configutation mode B */
108
102#define UART_MCR 4 /* Out: Modem Control Register */ 109#define UART_MCR 4 /* Out: Modem Control Register */
103#define UART_MCR_CLKSEL 0x80 /* Divide clock by 4 (TI16C752, EFR[4]=1) */ 110#define UART_MCR_CLKSEL 0x80 /* Divide clock by 4 (TI16C752, EFR[4]=1) */
104#define UART_MCR_TCRTLR 0x40 /* Access TCR/TLR (TI16C752, EFR[4]=1) */ 111#define UART_MCR_TCRTLR 0x40 /* Access TCR/TLR (TI16C752, EFR[4]=1) */