aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/mxs-auart.c
diff options
context:
space:
mode:
authorJanusz Uzycki <j.uzycki@elproma.com.pl>2014-10-10 12:53:24 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-06 17:57:18 -0500
commit42b4eba0612f87632a3e4d58c03f00e108e05dbc (patch)
tree376f97d9f6d5bf7703f0a35e6311a0a2722a69c1 /drivers/tty/serial/mxs-auart.c
parent66f37aafd6a6177287334397c59d7a727d16cd24 (diff)
serial: mxs-auart: clean get_mctrl and set_mctrl
Russell King: The only thing which the .get_mctrl method is supposed to do is to return the state of the /input/ lines, which are CTS, DCD, DSR, RI. The output line state is stored in port->mctrl, and is added to the returned value by serial_core when it's required. RTS output state should not be returned from the .get_mctrl method. This patch removes ctrl variable from mxs_auart_port and removes useless reading back RTS line. The ctrl variable in mxs_auart_port duplicated mctrl, member of uart_port structure in serial_core.h. The removed code from mxs_auart_set_mctrl() and mxs_auart_get_mctrl duplicated uart_update_mctrl() and uart_tiocmget() in serial_core.c. Signed-off-by: Janusz Uzycki <j.uzycki@elproma.com.pl> Reviewed-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/mxs-auart.c')
-rw-r--r--drivers/tty/serial/mxs-auart.c14
1 files changed, 1 insertions, 13 deletions
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index 0296c1c3b70e..907c3e521906 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -143,7 +143,6 @@ struct mxs_auart_port {
143#define MXS_AUART_DMA_RX_READY 3 /* bit 3 */ 143#define MXS_AUART_DMA_RX_READY 3 /* bit 3 */
144#define MXS_AUART_RTSCTS 4 /* bit 4 */ 144#define MXS_AUART_RTSCTS 4 /* bit 4 */
145 unsigned long flags; 145 unsigned long flags;
146 unsigned int ctrl;
147 enum mxs_auart_type devtype; 146 enum mxs_auart_type devtype;
148 147
149 unsigned int irq; 148 unsigned int irq;
@@ -406,8 +405,6 @@ static void mxs_auart_release_port(struct uart_port *u)
406 405
407static void mxs_auart_set_mctrl(struct uart_port *u, unsigned mctrl) 406static void mxs_auart_set_mctrl(struct uart_port *u, unsigned mctrl)
408{ 407{
409 struct mxs_auart_port *s = to_auart_port(u);
410
411 u32 ctrl = readl(u->membase + AUART_CTRL2); 408 u32 ctrl = readl(u->membase + AUART_CTRL2);
412 409
413 ctrl &= ~(AUART_CTRL2_RTSEN | AUART_CTRL2_RTS); 410 ctrl &= ~(AUART_CTRL2_RTSEN | AUART_CTRL2_RTS);
@@ -418,24 +415,17 @@ static void mxs_auart_set_mctrl(struct uart_port *u, unsigned mctrl)
418 ctrl |= AUART_CTRL2_RTS; 415 ctrl |= AUART_CTRL2_RTS;
419 } 416 }
420 417
421 s->ctrl = mctrl;
422 writel(ctrl, u->membase + AUART_CTRL2); 418 writel(ctrl, u->membase + AUART_CTRL2);
423} 419}
424 420
425static u32 mxs_auart_get_mctrl(struct uart_port *u) 421static u32 mxs_auart_get_mctrl(struct uart_port *u)
426{ 422{
427 struct mxs_auart_port *s = to_auart_port(u);
428 u32 stat = readl(u->membase + AUART_STAT); 423 u32 stat = readl(u->membase + AUART_STAT);
429 int ctrl2 = readl(u->membase + AUART_CTRL2); 424 u32 mctrl = 0;
430 u32 mctrl = s->ctrl;
431 425
432 mctrl &= ~TIOCM_CTS;
433 if (stat & AUART_STAT_CTS) 426 if (stat & AUART_STAT_CTS)
434 mctrl |= TIOCM_CTS; 427 mctrl |= TIOCM_CTS;
435 428
436 if (ctrl2 & AUART_CTRL2_RTS)
437 mctrl |= TIOCM_RTS;
438
439 return mctrl; 429 return mctrl;
440} 430}
441 431
@@ -1071,8 +1061,6 @@ static int mxs_auart_probe(struct platform_device *pdev)
1071 s->port.type = PORT_IMX; 1061 s->port.type = PORT_IMX;
1072 s->port.dev = s->dev = &pdev->dev; 1062 s->port.dev = s->dev = &pdev->dev;
1073 1063
1074 s->ctrl = 0;
1075
1076 s->irq = platform_get_irq(pdev, 0); 1064 s->irq = platform_get_irq(pdev, 0);
1077 s->port.irq = s->irq; 1065 s->port.irq = s->irq;
1078 ret = request_irq(s->irq, mxs_auart_irq_handle, 0, dev_name(&pdev->dev), s); 1066 ret = request_irq(s->irq, mxs_auart_irq_handle, 0, dev_name(&pdev->dev), s);