Commit 422c6d3b authored by Maarten Brock's avatar Maarten Brock Committed by Greg Kroah-Hartman

serial: xilinx_uartps: Let get_mctrl return status

Some of the applications like microcom do not work if
modem is disabled. To fix them we always return
TIOCM_CTS | TIOCM_DSR | TIOCM_CAR instead of 0 when
using cts_override. Make get_mctrl return actual status
when not using cts_override.
Signed-off-by: default avatarMaarten Brock <m.brock@vanmierlo.com>
Signed-off-by: default avatarShubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Link: https://lore.kernel.org/r/1574687731-21563-1-git-send-email-shubhrajyoti.datta@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 67e977f3
...@@ -153,6 +153,16 @@ MODULE_PARM_DESC(rx_timeout, "Rx timeout, 1-255"); ...@@ -153,6 +153,16 @@ MODULE_PARM_DESC(rx_timeout, "Rx timeout, 1-255");
#define CDNS_UART_MODEMCR_RTS 0x00000002 /* Request to send output control */ #define CDNS_UART_MODEMCR_RTS 0x00000002 /* Request to send output control */
#define CDNS_UART_MODEMCR_DTR 0x00000001 /* Data Terminal Ready */ #define CDNS_UART_MODEMCR_DTR 0x00000001 /* Data Terminal Ready */
/*
* Modem Status register:
* The read/write Modem Status register reports the interface with the modem
* or data set, or a peripheral device emulating a modem.
*/
#define CDNS_UART_MODEMSR_DCD BIT(7) /* Data Carrier Detect */
#define CDNS_UART_MODEMSR_RI BIT(6) /* Ting Indicator */
#define CDNS_UART_MODEMSR_DSR BIT(5) /* Data Set Ready */
#define CDNS_UART_MODEMSR_CTS BIT(4) /* Clear To Send */
/* /*
* Channel Status Register: * Channel Status Register:
* The channel status register (CSR) is provided to enable the control logic * The channel status register (CSR) is provided to enable the control logic
...@@ -1003,12 +1013,24 @@ static void cdns_uart_config_port(struct uart_port *port, int flags) ...@@ -1003,12 +1013,24 @@ static void cdns_uart_config_port(struct uart_port *port, int flags)
*/ */
static unsigned int cdns_uart_get_mctrl(struct uart_port *port) static unsigned int cdns_uart_get_mctrl(struct uart_port *port)
{ {
u32 val;
unsigned int mctrl = 0;
struct cdns_uart *cdns_uart_data = port->private_data; struct cdns_uart *cdns_uart_data = port->private_data;
if (cdns_uart_data->cts_override) if (cdns_uart_data->cts_override)
return 0; return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR;
return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR; val = readl(port->membase + CDNS_UART_MODEMSR);
if (val & CDNS_UART_MODEMSR_CTS)
mctrl |= TIOCM_CTS;
if (val & CDNS_UART_MODEMSR_DSR)
mctrl |= TIOCM_DSR;
if (val & CDNS_UART_MODEMSR_RI)
mctrl |= TIOCM_RNG;
if (val & CDNS_UART_MODEMSR_DCD)
mctrl |= TIOCM_CAR;
return mctrl;
} }
static void cdns_uart_set_mctrl(struct uart_port *port, unsigned int mctrl) static void cdns_uart_set_mctrl(struct uart_port *port, unsigned int mctrl)
......
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