serial: Support for RS-485 multipoint addresses
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Fri, 24 Jun 2022 20:42:09 +0000 (23:42 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Jun 2022 12:44:20 +0000 (14:44 +0200)
commit4f768e94774c58c9f7f54ebd38dadf172970046a
treef237520975e9f0839fd2dbbd911d2681288f949e
parentae50bb2752836277ae15aa4e9d99074d6d947946
serial: Support for RS-485 multipoint addresses

Add support for RS-485 multipoint addressing using 9th bit [*]. The
addressing mode is configured through ->rs485_config().

ADDRB in termios indicates 9th bit addressing mode is enabled. In this
mode, 9th bit is used to indicate an address (byte) within the
communication line. ADDRB can only be enabled/disabled through
->rs485_config() that is also responsible for setting the destination and
receiver (filter) addresses.

Add traps to detect unwanted changes to struct serial_rs485 layout using
static_assert().

[*] 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.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220624204210.11112-6-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Documentation/driver-api/serial/driver.rst
Documentation/driver-api/serial/serial-rs485.rst
drivers/tty/serial/serial_core.c
drivers/tty/tty_ioctl.c
include/uapi/asm-generic/termbits-common.h
include/uapi/linux/serial.h