Commit 37ba760b authored by Baolin Wang's avatar Baolin Wang Committed by Greg Kroah-Hartman

serial: sprd: Add loopback function support

Add loopback function support for Spreadtrum serial controller.
Signed-off-by: default avatarBaolin Wang <baolin.wang@linaro.org>
Link: https://lore.kernel.org/r/1275cd9968f1ceb5ac049cc23f1e508025cd552f.1566375260.git.baolin.wang@linaro.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6cbdf5c6
......@@ -79,6 +79,7 @@
/* control register 1 */
#define SPRD_CTL1 0x001C
#define SPRD_DMA_EN BIT(15)
#define SPRD_LOOPBACK_EN BIT(14)
#define RX_HW_FLOW_CTL_THLD BIT(6)
#define RX_HW_FLOW_CTL_EN BIT(7)
#define TX_HW_FLOW_CTL_EN BIT(8)
......@@ -164,7 +165,14 @@ static unsigned int sprd_get_mctrl(struct uart_port *port)
static void sprd_set_mctrl(struct uart_port *port, unsigned int mctrl)
{
/* nothing to do */
u32 val = serial_in(port, SPRD_CTL1);
if (mctrl & TIOCM_LOOP)
val |= SPRD_LOOPBACK_EN;
else
val &= ~SPRD_LOOPBACK_EN;
serial_out(port, SPRD_CTL1, val);
}
static void sprd_stop_rx(struct uart_port *port)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment