Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933904AbdK1LCF (ORCPT ); Tue, 28 Nov 2017 06:02:05 -0500 Received: from mx1.comcard.de ([195.243.195.116]:45937 "EHLO mx1.comcard.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754247AbdK1LCB (ORCPT ); Tue, 28 Nov 2017 06:02:01 -0500 X-Greylist: delayed 349 seconds by postgrey-1.27 at vger.kernel.org; Tue, 28 Nov 2017 06:02:01 EST X-CTCH-RefID: str=0001.0A090205.5A1D40BF.00AC,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 From: Lars Kanis To: Greg Kroah-Hartman , Jiri Slaby , CC: Lars Kanis Subject: [PATCH] tty: moxa: Add support for CMSPAR Date: Tue, 28 Nov 2017 11:55:17 +0100 Message-ID: <1511866517-14339-1-git-send-email-kanis@comcard.de> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.0.0.1727-8.100.1062-23496.005 X-TM-AS-Result: No--7.018700-0.000000-31 X-TM-AS-MatchedID: 140275-703529-121336-708060-186035-712057-703135-708712-7 03756-701837-862883-188019-706290-703454-106390-121169-148004-148036-42000- 42003-63 X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/tty/moxa.c | 17 +++++++++++------ drivers/tty/moxa.h | 2 ++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c index 68cbc03..250a19f 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; diff --git a/drivers/tty/moxa.h b/drivers/tty/moxa.h index 8ce89fd..563d2dc 100644 --- a/drivers/tty/moxa.h +++ b/drivers/tty/moxa.h @@ -301,5 +301,7 @@ #define MX_PARNONE 0x00 #define MX_PAREVEN 0x40 #define MX_PARODD 0xC0 +#define MX_PARMARK 0xA0 +#define MX_PARSPACE 0x20 #endif -- 2.7.4