]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
serial: imx: add support for loopback mode.
authorHuang Shijie <b32955@freescale.com>
Fri, 29 Nov 2013 09:29:24 +0000 (17:29 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 Dec 2013 01:09:07 +0000 (17:09 -0800)
Add the loopback mode support for imx uart driver.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/imx.c

index b2cfdb661947ec2690fc4840e089688151749a68..d799140e53b6a649b51ace8129b8846ed695a824 100644 (file)
@@ -806,6 +806,9 @@ static unsigned int imx_get_mctrl(struct uart_port *port)
        if (readl(sport->port.membase + UCR2) & UCR2_CTS)
                tmp |= TIOCM_RTS;
 
+       if (readl(sport->port.membase + uts_reg(sport)) & UTS_LOOP)
+               tmp |= TIOCM_LOOP;
+
        return tmp;
 }
 
@@ -821,6 +824,11 @@ static void imx_set_mctrl(struct uart_port *port, unsigned int mctrl)
                        temp |= UCR2_CTS;
 
        writel(temp, sport->port.membase + UCR2);
+
+       temp = readl(sport->port.membase + uts_reg(sport)) & ~UTS_LOOP;
+       if (mctrl & TIOCM_LOOP)
+               temp |= UTS_LOOP;
+       writel(temp, sport->port.membase + uts_reg(sport));
 }
 
 /*