Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Lars Kanis and committed by
Greg Kroah-Hartman
d8dcbdd0 e73be92d

+13 -6
+11 -6
drivers/tty/moxa.c
··· 1487 1487 if (ts->c_iflag & IXANY) 1488 1488 xany = 1; 1489 1489 1490 - /* Clear the features we don't support */ 1491 - ts->c_cflag &= ~CMSPAR; 1492 1490 MoxaPortFlowCtrl(ch, rts, cts, txflow, rxflow, xany); 1493 1491 baud = MoxaPortSetTermio(ch, ts, tty_get_baud_rate(tty)); 1494 1492 if (baud == -1) ··· 1779 1781 mode |= MX_STOP1; 1780 1782 1781 1783 if (termio->c_cflag & PARENB) { 1782 - if (termio->c_cflag & PARODD) 1783 - mode |= MX_PARODD; 1784 - else 1785 - mode |= MX_PAREVEN; 1784 + if (termio->c_cflag & PARODD) { 1785 + if (termio->c_cflag & CMSPAR) 1786 + mode |= MX_PARMARK; 1787 + else 1788 + mode |= MX_PARODD; 1789 + } else { 1790 + if (termio->c_cflag & CMSPAR) 1791 + mode |= MX_PARSPACE; 1792 + else 1793 + mode |= MX_PAREVEN; 1794 + } 1786 1795 } else 1787 1796 mode |= MX_PARNONE; 1788 1797
+2
drivers/tty/moxa.h
··· 301 301 #define MX_PARNONE 0x00 302 302 #define MX_PAREVEN 0x40 303 303 #define MX_PARODD 0xC0 304 + #define MX_PARMARK 0xA0 305 + #define MX_PARSPACE 0x20 304 306 305 307 #endif