@@ -180,6 +180,7 @@ struct ktermios {
#define HUPCL 00040000
#define CLOCAL 00100000
+#define ADDRB 010000000 /* address bit */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
@@ -181,6 +181,7 @@ struct ktermios {
#define B3000000 0010015
#define B3500000 0010016
#define B4000000 0010017
+#define ADDRB 0020000 /* address bit */
#define CIBAUD 002003600000 /* input baud rate */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
@@ -158,6 +158,7 @@ struct ktermios {
#define B3000000 0010015
#define B3500000 0010016
#define B4000000 0010017
+#define ADDRB 0020000 /* address bit */
#define CIBAUD 002003600000 /* input baud rate */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
@@ -171,6 +171,7 @@ struct ktermios {
#define HUPCL 00040000
#define CLOCAL 00100000
+#define ADDRB 00200000 /* address bit */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
@@ -200,6 +200,7 @@ struct ktermios {
#define B3000000 0x00001011
#define B3500000 0x00001012
#define B4000000 0x00001013 */
+#define ADDRB 0x00002000 /* address bit */
#define CIBAUD 0x100f0000 /* input baud rate (not used) */
#define CMSPAR 0x40000000 /* mark or space (stick) parity */
#define CRTSCTS 0x80000000 /* flow control */
@@ -2287,6 +2287,8 @@ static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_term
== RELEVANT_IFLAG(old_termios->c_iflag)))
return;
+ tty->termios.c_cflag &= ~ADDRB;
+
mgslpc_change_params(info, tty);
/* Handle transition to B0 status */
@@ -506,6 +506,8 @@ static void ipoctal_set_termios(struct tty_struct *tty,
struct ipoctal_channel *channel = tty->driver_data;
speed_t baud;
+ tty->termios.c_cflag &= ~ADDRB;
+
cflag = tty->termios.c_cflag;
/* Disable and reset everything before change the setup */
@@ -880,6 +880,8 @@ static void sdio_uart_set_termios(struct tty_struct *tty,
if (sdio_uart_claim_func(port) != 0)
return;
+ tty->termios.c_cflag &= ~ADDRB;
+
sdio_uart_change_speed(port, &tty->termios, old_termios);
/* Handle transition to B0 status */
@@ -1099,7 +1099,8 @@ static void _hso_serial_set_termios(struct tty_struct *tty)
~(CSIZE /* no size */
| PARENB /* disable parity bit */
| CBAUD /* clear current baud rate */
- | CBAUDEX); /* clear current buad rate */
+ | CBAUDEX /* clear current baud rate */
+ | ADDRB); /* disable 9th (addr) bit */
tty->termios.c_cflag |= CS8; /* character size 8 bits */
@@ -1768,6 +1768,9 @@ tty3270_set_termios(struct tty_struct *tty, struct ktermios *old)
tp = tty->driver_data;
if (!tp)
return;
+
+ tty->termios.c_cflag &= ~ADDRB;
+
spin_lock_bh(&tp->view.lock);
if (L_ICANON(tty)) {
new = L_ECHO(tty) ? TF_INPUT: TF_INPUTN;
@@ -487,6 +487,8 @@ static void gb_tty_set_termios(struct tty_struct *tty,
struct ktermios *termios = &tty->termios;
u8 newctrl = gb_tty->ctrlout;
+ termios->c_cflag &= ~ADDRB;
+
newline.rate = cpu_to_le32(tty_get_baud_rate(tty));
newline.format = termios->c_cflag & CSTOPB ?
GB_SERIAL_2_STOP_BITS : GB_SERIAL_1_STOP_BITS;
@@ -1175,7 +1175,11 @@ static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
{
struct serial_state *info = tty->driver_data;
unsigned long flags;
- unsigned int cflag = tty->termios.c_cflag;
+ unsigned int cflag;
+
+ tty->termios.c_cflag &= ~ADDRB;
+
+ cflag = tty->termios.c_cflag;
change_speed(tty, info, old_termios);
@@ -2050,6 +2050,7 @@ static int MoxaPortSetTermio(struct moxa_port *port, struct ktermios *termio,
ofsAddr = port->tableAddr;
+ termio->c_cflag &= ~ADDRB;
mode = termio->c_cflag & CSIZE;
if (mode == CS5)
mode = MX_CS5;
@@ -577,6 +577,7 @@ static void mxser_change_speed(struct tty_struct *tty, struct ktermios *old_term
struct mxser_port *info = tty->driver_data;
unsigned cflag, cval;
+ tty->termios.c_cflag &= ~ADDRB;
cflag = tty->termios.c_cflag;
if (mxser_set_baud(tty, tty_get_baud_rate(tty))) {
@@ -1493,6 +1493,8 @@ static void uart_set_termios(struct tty_struct *tty,
goto out;
}
+ tty->termios.c_cflag &= ~ADDRB;
+
uart_change_speed(tty, state, old_termios);
/* reload cflag from termios; port driver may have overridden flags */
cflag = tty->termios.c_cflag;
@@ -714,6 +714,8 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios)
DBGINFO(("%s set_termios\n", tty->driver->name));
+ tty->termios.c_cflag &= ~ADDRB;
+
change_params(info);
/* Handle transition to B0 status */
@@ -319,6 +319,8 @@ unsigned char tty_get_frame_size(unsigned int cflag)
bits++;
if (cflag & PARENB)
bits++;
+ if (cflag & ADDRB)
+ bits++;
return bits;
}
@@ -1056,6 +1056,8 @@ static void acm_tty_set_termios(struct tty_struct *tty,
struct usb_cdc_line_coding newline;
int newctrl = acm->ctrlout;
+ termios->c_cflag &= ~ADDRB;
+
newline.dwDTERate = cpu_to_le32(tty_get_baud_rate(tty));
newline.bCharFormat = termios->c_cflag & CSTOPB ? 2 : 0;
newline.bParityType = termios->c_cflag & PARENB ?
@@ -525,10 +525,12 @@ static void serial_set_termios(struct tty_struct *tty, struct ktermios *old)
dev_dbg(&port->dev, "%s\n", __func__);
- if (port->serial->type->set_termios)
+ if (port->serial->type->set_termios) {
+ tty->termios.c_cflag &= ~ADDRB;
port->serial->type->set_termios(tty, port, old);
- else
+ } else {
tty_termios_copy_hw(&tty->termios, old);
+ }
}
static int serial_break(struct tty_struct *tty, int break_state)
@@ -157,6 +157,7 @@ struct ktermios {
#define B3000000 0010015
#define B3500000 0010016
#define B4000000 0010017
+#define ADDRB 0020000 /* address bit */
#define CIBAUD 002003600000 /* input baud rate */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
@@ -871,6 +871,8 @@ static void rfcomm_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
if (!dev || !dev->dlc || !dev->dlc->session)
return;
+ new->c_cflag &= ~ADDRB;
+
/* Handle turning off CRTSCTS */
if ((old->c_cflag & CRTSCTS) && !(new->c_cflag & CRTSCTS))
BT_DBG("Turning off CRTSCTS unsupported");
Add ADDRB to termbits to indicate 9th bit addressing mode. This change is necessary for supporting devices with RS485 multipoint addressing [*]. A later patch in the patch series adds support for Synopsys Designware UART capable for 9th bit addressing mode. In this mode, 9th bit is used to indicate an address (byte) within the communication line. The 9th bit addressing mode is selected using ADDRB introduced by an earlier patch. [*] Technically, RS485 is just an electronic spec and does not itself specify the 9th bit addressing mode but 9th bit seems at least "semi-standard" way to do addressing with RS485. Cc: linux-api@vger.kernel.org Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: Matt Turner <mattst88@gmail.com> Cc: linux-alpha@vger.kernel.org Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: linux-mips@vger.kernel.org Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com> Cc: Helge Deller <deller@gmx.de> Cc: linux-parisc@vger.kernel.org Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: linuxppc-dev@lists.ozlabs.org Cc: "David S. Miller" <davem@davemloft.net> Cc: sparclinux@vger.kernel.org Cc: Arnd Bergmann <arnd@arndb.de> Cc: linux-arch@vger.kernel.org Cc: linux-usb@vger.kernel.org Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> --- arch/alpha/include/uapi/asm/termbits.h | 1 + arch/mips/include/uapi/asm/termbits.h | 1 + arch/parisc/include/uapi/asm/termbits.h | 1 + arch/powerpc/include/uapi/asm/termbits.h | 1 + arch/sparc/include/uapi/asm/termbits.h | 1 + drivers/char/pcmcia/synclink_cs.c | 2 ++ drivers/ipack/devices/ipoctal.c | 2 ++ drivers/mmc/core/sdio_uart.c | 2 ++ drivers/net/usb/hso.c | 3 ++- drivers/s390/char/tty3270.c | 3 +++ drivers/staging/greybus/uart.c | 2 ++ drivers/tty/amiserial.c | 6 +++++- drivers/tty/moxa.c | 1 + drivers/tty/mxser.c | 1 + drivers/tty/serial/serial_core.c | 2 ++ drivers/tty/synclink_gt.c | 2 ++ drivers/tty/tty_ioctl.c | 2 ++ drivers/usb/class/cdc-acm.c | 2 ++ drivers/usb/serial/usb-serial.c | 6 ++++-- include/uapi/asm-generic/termbits.h | 1 + net/bluetooth/rfcomm/tty.c | 2 ++ 21 files changed, 40 insertions(+), 4 deletions(-)