aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQipan Li <Qipan.Li@csr.com>2015-05-14 02:45:25 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-05-24 15:50:41 -0400
commit7f60f2fe16206d5db6a228dfe1de5ea0a9e5da46 (patch)
tree6ba0de32add0c54ef2ad25241645f60e6f0bea8f
parentd9e8e976faef867f9be579d6a76e1271d5d30da8 (diff)
serial: sirf: add serial loopback function support
Signed-off-by: Qipan Li <Qipan.Li@csr.com> Signed-off-by: Barry Song <Baohua.Song@csr.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/serial/sirfsoc_uart.c20
-rw-r--r--drivers/tty/serial/sirfsoc_uart.h2
2 files changed, 21 insertions, 1 deletions
diff --git a/drivers/tty/serial/sirfsoc_uart.c b/drivers/tty/serial/sirfsoc_uart.c
index a5007216338d..0e4379939703 100644
--- a/drivers/tty/serial/sirfsoc_uart.c
+++ b/drivers/tty/serial/sirfsoc_uart.c
@@ -108,6 +108,26 @@ static void sirfsoc_uart_set_mctrl(struct uart_port *port, unsigned int mctrl)
108 unsigned int val = assert ? SIRFUART_AFC_CTRL_RX_THD : 0x0; 108 unsigned int val = assert ? SIRFUART_AFC_CTRL_RX_THD : 0x0;
109 unsigned int current_val; 109 unsigned int current_val;
110 110
111 if (mctrl & TIOCM_LOOP) {
112 if (sirfport->uart_reg->uart_type == SIRF_REAL_UART)
113 wr_regl(port, ureg->sirfsoc_line_ctrl,
114 rd_regl(port, ureg->sirfsoc_line_ctrl) |
115 SIRFUART_LOOP_BACK);
116 else
117 wr_regl(port, ureg->sirfsoc_mode1,
118 rd_regl(port, ureg->sirfsoc_mode1) |
119 SIRFSOC_USP_LOOP_BACK_CTRL);
120 } else {
121 if (sirfport->uart_reg->uart_type == SIRF_REAL_UART)
122 wr_regl(port, ureg->sirfsoc_line_ctrl,
123 rd_regl(port, ureg->sirfsoc_line_ctrl) &
124 ~SIRFUART_LOOP_BACK);
125 else
126 wr_regl(port, ureg->sirfsoc_mode1,
127 rd_regl(port, ureg->sirfsoc_mode1) &
128 ~SIRFSOC_USP_LOOP_BACK_CTRL);
129 }
130
111 if (!sirfport->hw_flow_ctrl || !sirfport->ms_enabled) 131 if (!sirfport->hw_flow_ctrl || !sirfport->ms_enabled)
112 return; 132 return;
113 if (sirfport->uart_reg->uart_type == SIRF_REAL_UART) { 133 if (sirfport->uart_reg->uart_type == SIRF_REAL_UART) {
diff --git a/drivers/tty/serial/sirfsoc_uart.h b/drivers/tty/serial/sirfsoc_uart.h
index b49c23a94ee8..3ab3141e1aae 100644
--- a/drivers/tty/serial/sirfsoc_uart.h
+++ b/drivers/tty/serial/sirfsoc_uart.h
@@ -322,7 +322,7 @@ struct sirfsoc_uart_register sirfsoc_uart = {
322#define SIRFSOC_USP_RX_CLK_DIVISOR_OFFSET 24 322#define SIRFSOC_USP_RX_CLK_DIVISOR_OFFSET 24
323#define SIRFSOC_USP_ASYNC_DIV2_MASK 0x3f 323#define SIRFSOC_USP_ASYNC_DIV2_MASK 0x3f
324#define SIRFSOC_USP_ASYNC_DIV2_OFFSET 16 324#define SIRFSOC_USP_ASYNC_DIV2_OFFSET 16
325 325#define SIRFSOC_USP_LOOP_BACK_CTRL BIT(2)
326/* USP-UART Common */ 326/* USP-UART Common */
327#define SIRFSOC_UART_RX_TIMEOUT(br, to) (((br) * (((to) + 999) / 1000)) / 1000) 327#define SIRFSOC_UART_RX_TIMEOUT(br, to) (((br) * (((to) + 999) / 1000)) / 1000)
328#define SIRFUART_RECV_TIMEOUT_VALUE(x) \ 328#define SIRFUART_RECV_TIMEOUT_VALUE(x) \