summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/sh-sci.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2011-11-24 20:20:53 +0900
committerPaul Mundt <lethal@linux-sh.org>2011-11-24 20:20:53 +0900
commitdc7e3ef7dade7041fb1809f2a5403efac655a791 (patch)
tree0ff9ec0b0ee270c9c737b15ae66462aefba9abff /drivers/tty/serial/sh-sci.c
parentcdf7c42fece7c641fcb85cfbf190fdc2a95d19ac (diff)
downloadlinux-3.10-dc7e3ef7dade7041fb1809f2a5403efac655a791.tar.gz
linux-3.10-dc7e3ef7dade7041fb1809f2a5403efac655a791.tar.bz2
linux-3.10-dc7e3ef7dade7041fb1809f2a5403efac655a791.zip
serial: sh-sci: Add support for loopback mode.
This plugs in loopback control for SCFCR-enabled ports and plugs it in via the TIOCM_LOOP control, as others do. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/tty/serial/sh-sci.c')
-rw-r--r--drivers/tty/serial/sh-sci.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 680d34af71f..46deaaec836 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1113,10 +1113,23 @@ static unsigned int sci_tx_empty(struct uart_port *port)
* handled via the ->init_pins() op, which is a bit of a one-way street,
* lacking any ability to defer pin control -- this will later be
* converted over to the GPIO framework).
+ *
+ * Other modes (such as loopback) are supported generically on certain
+ * port types, but not others. For these it's sufficient to test for the
+ * existence of the support register and simply ignore the port type.
*/
static void sci_set_mctrl(struct uart_port *port, unsigned int mctrl)
{
- /* Nothing to do here. */
+ if (mctrl & TIOCM_LOOP) {
+ struct plat_sci_reg *reg;
+
+ /*
+ * Standard loopback mode for SCFCR ports.
+ */
+ reg = sci_getreg(port, SCFCR);
+ if (reg->size)
+ sci_out(port, SCFCR, sci_in(port, SCFCR) | 1);
+ }
}
static unsigned int sci_get_mctrl(struct uart_port *port)