summaryrefslogtreecommitdiff
path: root/drivers/tty/moxa.c
diff options
context:
space:
mode:
authorLars Kanis <kanis@comcard.de>2017-11-28 11:55:17 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-11-28 15:32:33 +0100
commitd8dcbdd08c653d9a6754b3c775f13cb987fa91ec (patch)
treef7c4afc1fe43cc9f1520641ac5c5b6e2db656137 /drivers/tty/moxa.c
parente73be92d82e6a842eda6adac339963a3560ca0e4 (diff)
tty: moxa: Add support for CMSPAR
The mode constants are taken from the GPL-2.0+ driver available in the driver section of the Moxa homepage. It is tested on a C320Turbo PCI card per logic analyzer and per a device which requires 9 bit character communication. The vendors driver supports CMSPAR unconditionally, so that all other available firmware versions seems to support mark/space parity modes as well. Signed-off-by: Lars Kanis <kanis@comcard.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/moxa.c')
-rw-r--r--drivers/tty/moxa.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c
index 68cbc03aab4b..250a19f042d7 100644
--- a/drivers/tty/moxa.c
+++ b/drivers/tty/moxa.c
@@ -1487,8 +1487,6 @@ static void moxa_set_tty_param(struct tty_struct *tty, struct ktermios *old_term
if (ts->c_iflag & IXANY)
xany = 1;
- /* Clear the features we don't support */
- ts->c_cflag &= ~CMSPAR;
MoxaPortFlowCtrl(ch, rts, cts, txflow, rxflow, xany);
baud = MoxaPortSetTermio(ch, ts, tty_get_baud_rate(tty));
if (baud == -1)
@@ -1781,10 +1779,17 @@ static int MoxaPortSetTermio(struct moxa_port *port, struct ktermios *termio,
mode |= MX_STOP1;
if (termio->c_cflag & PARENB) {
- if (termio->c_cflag & PARODD)
- mode |= MX_PARODD;
- else
- mode |= MX_PAREVEN;
+ if (termio->c_cflag & PARODD) {
+ if (termio->c_cflag & CMSPAR)
+ mode |= MX_PARMARK;
+ else
+ mode |= MX_PARODD;
+ } else {
+ if (termio->c_cflag & CMSPAR)
+ mode |= MX_PARSPACE;
+ else
+ mode |= MX_PAREVEN;
+ }
} else
mode |= MX_PARNONE;