aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorPramod Gurav <pramod.gurav@smartplayin.com>2015-01-12 08:45:32 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-02-02 13:11:25 -0500
commit4daba33466a81197e65c1a86cc1e1d1ca4e70939 (patch)
tree3ac70e06068fea4fa4d76407deff8e19497cc520 /drivers/tty
parent0a0d412abe473c37ddec8d3f6c0b84c58f1bb061 (diff)
tty: serial: msm_serial: code cleanup in msm_console_setup
The change does following: - baud, flow, bits, parity were being overwritten as they were being reinitialized after parsing. Initialize them when they are declared so that user provided setting are not overwritten. - msm_set_baud_rate() is anyway called in uart_set_options when it calls msm_set_termios(). msm_reset() is called when we change the baud rate. Hence doing away with both of these calls. - CR_CMD_PROTECTION_EN and CR_TX_ENABLE settings are done in msm_set_baud_rate. So do away with this here. Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/msm_serial.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index c88b522ccd73..a0cc6e08552f 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -920,14 +920,15 @@ static void msm_console_write(struct console *co, const char *s,
920static int __init msm_console_setup(struct console *co, char *options) 920static int __init msm_console_setup(struct console *co, char *options)
921{ 921{
922 struct uart_port *port; 922 struct uart_port *port;
923 struct msm_port *msm_port; 923 int baud = 115200;
924 int baud = 0, flow, bits, parity; 924 int bits = 8;
925 int parity = 'n';
926 int flow = 'n';
925 927
926 if (unlikely(co->index >= UART_NR || co->index < 0)) 928 if (unlikely(co->index >= UART_NR || co->index < 0))
927 return -ENXIO; 929 return -ENXIO;
928 930
929 port = get_port_from_line(co->index); 931 port = get_port_from_line(co->index);
930 msm_port = UART_TO_MSM(port);
931 932
932 if (unlikely(!port->membase)) 933 if (unlikely(!port->membase))
933 return -ENXIO; 934 return -ENXIO;
@@ -937,23 +938,6 @@ static int __init msm_console_setup(struct console *co, char *options)
937 if (options) 938 if (options)
938 uart_parse_options(options, &baud, &parity, &bits, &flow); 939 uart_parse_options(options, &baud, &parity, &bits, &flow);
939 940
940 bits = 8;
941 parity = 'n';
942 flow = 'n';
943 msm_write(port, UART_MR2_BITS_PER_CHAR_8 | UART_MR2_STOP_BIT_LEN_ONE,
944 UART_MR2); /* 8N1 */
945
946 if (baud < 300 || baud > 115200)
947 baud = 115200;
948 msm_set_baud_rate(port, baud);
949
950 msm_reset(port);
951
952 if (msm_port->is_uartdm) {
953 msm_write(port, UART_CR_CMD_PROTECTION_EN, UART_CR);
954 msm_write(port, UART_CR_TX_ENABLE, UART_CR);
955 }
956
957 pr_info("msm_serial: console setup on port #%d\n", port->line); 941 pr_info("msm_serial: console setup on port #%d\n", port->line);
958 942
959 return uart_set_options(port, co, baud, parity, bits, flow); 943 return uart_set_options(port, co, baud, parity, bits, flow);