All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/12] Add RS485 support to DW UART
@ 2022-04-11  8:33 Ilpo Järvinen
  2022-04-11  8:33 ` [PATCH v3 01/12] serial: Store character timing information to uart_port Ilpo Järvinen
                   ` (12 more replies)
  0 siblings, 13 replies; 30+ messages in thread
From: Ilpo Järvinen @ 2022-04-11  8:33 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Lukas Wunner, Andy Shevchenko
  Cc: Johan Hovold, heiko, giulio.benetti, Heikki Krogerus,
	Uwe Kleine-König, Ilpo Järvinen, linux-api

This patchset adds RS-485 support to the DW UART driver. The patchset
has two main parts. The first part adds HW support for RS-485 itself
in various modes of operation and the second part focuses on enabling
9th bit addressing mode that can be used on a multipoint RS-485
communications line.

To configure multipoint addressing, ADDRB flag is added to termios
and two new IOCTLs are added into serial core. Lukas Wunner brought up
during v1 review that if this addressing is only going to be used with
RS-485, doing it within rs485_config would avoid having to add those
IOCTLs. There was some counterexample w/o further details mentioned for
RS-232 usage by Andy Shevchenko. I left the IOCTL approach there but if
somebody has further input on this, please voice it as it is user-space
facing API.

I decided to rewrite the UART_CAP_NOTEMT patch from scratch myself
based on Uwe Kleine-König's earlier suggestion and include it to this
series. To make waiting for a single character easy and to avoid
storing it per purpose in the uart drivers, I decided to add
frame_time into uart_port. It turned out to beneficial also for serial
core which had to reverse calculate it from uart_port->timeout). I was
thinking of removing uart_port->timeout entirely and derive the value
timeout from frame_time and fifosize where needed but I was not sure
if that's ok to do lockingwise (not that fifosize is a variable that
is expected to change so maybe I'm just being too cautious).

Cc: linux-api@vger.kernel.org

v1 -> v2:
- Add uart_port->frame_time to avoid the need to store it per purpose
- Included NOTEMT patch rewritten from scratch
- Merge HW half & full-duplex patches
- Detect RS485 HW using RE_EN register write+read
- Removed SER_RS485_SW_RX_OR_TX
- Relocated/renamed RE polarity DT prop
- Use SER_RS485_RTS_ON_SEND rather than DT prop directly
- Removed DE polarity prop, it is still configurable but with rts one instead
- Make DE active-high by default in dwlib
- Don't unnecessarily clear DE/RE_EN for non-RS485 mode
- Prevent ADDRB and addrmode desync for RS485->RS232 transition
- Added ACPI enumeration doc
- Changed -EINVAL to -ENOTTY if no set/get_addr handler is present
- Clear ADDRB in set_termios of a few more drivers
- Added filtering for addresses to avoid them leaking into data stream
- Reworded comments & commit messages as requested

v2 -> v3
- Change ADDRB to 0x20000000 which is free for all archs
- Added TIOCSADDR/GADDR to tty_compat_ioctl

Ilpo Järvinen (12):
  serial: Store character timing information to uart_port
  serial: 8250: Handle UART without interrupt on TEMT
  serial: 8250_dwlib: RS485 HW half & full duplex support
  serial: 8250_dwlib: Implement SW half duplex support
  dt_bindings: rs485: Add receiver enable polarity
  ACPI / property: Document RS485 _DSD properties
  serial: termbits: ADDRB to indicate 9th bit addressing mode
  serial: General support for multipoint addresses
  serial: 8250: make saved LSR larger
  serial: 8250: create lsr_save_mask
  serial: 8250_lpss: Use 32-bit reads
  serial: 8250_dwlib: Support for 9th bit multipoint addressing

 .../devicetree/bindings/serial/rs485.yaml     |   5 +
 .../driver-api/serial/serial-rs485.rst        |  23 +-
 .../firmware-guide/acpi/enumeration.rst       |  25 ++
 arch/alpha/include/uapi/asm/ioctls.h          |   3 +
 arch/alpha/include/uapi/asm/termbits.h        |   1 +
 arch/mips/include/uapi/asm/ioctls.h           |   3 +
 arch/mips/include/uapi/asm/termbits.h         |   1 +
 arch/parisc/include/uapi/asm/ioctls.h         |   3 +
 arch/parisc/include/uapi/asm/termbits.h       |   1 +
 arch/powerpc/include/uapi/asm/ioctls.h        |   3 +
 arch/powerpc/include/uapi/asm/termbits.h      |   1 +
 arch/sh/include/uapi/asm/ioctls.h             |   3 +
 arch/sparc/include/uapi/asm/ioctls.h          |   3 +
 arch/sparc/include/uapi/asm/termbits.h        |   1 +
 arch/xtensa/include/uapi/asm/ioctls.h         |   3 +
 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/8250/8250.h                |   1 +
 drivers/tty/serial/8250/8250_core.c           |   6 +-
 drivers/tty/serial/8250/8250_dwlib.c          | 232 +++++++++++++++++-
 drivers/tty/serial/8250/8250_dwlib.h          |   5 +
 drivers/tty/serial/8250/8250_lpss.c           |   2 +-
 drivers/tty/serial/8250/8250_port.c           |  42 ++--
 drivers/tty/serial/serial_core.c              |  76 +++++-
 drivers/tty/synclink_gt.c                     |   2 +
 drivers/tty/tty_io.c                          |   2 +
 drivers/tty/tty_ioctl.c                       |   2 +
 drivers/usb/class/cdc-acm.c                   |   2 +
 drivers/usb/serial/usb-serial.c               |   6 +-
 include/linux/serial_8250.h                   |   7 +-
 include/linux/serial_core.h                   |   7 +
 include/uapi/asm-generic/ioctls.h             |   3 +
 include/uapi/asm-generic/termbits.h           |   1 +
 include/uapi/linux/serial.h                   |   8 +
 net/bluetooth/rfcomm/tty.c                    |   2 +
 42 files changed, 472 insertions(+), 35 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2022-04-25 11:16 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-11  8:33 [PATCH v3 00/12] Add RS485 support to DW UART Ilpo Järvinen
2022-04-11  8:33 ` [PATCH v3 01/12] serial: Store character timing information to uart_port Ilpo Järvinen
2022-04-11 10:52   ` Andy Shevchenko
2022-04-11 10:56     ` Andy Shevchenko
2022-04-11 11:00       ` Andy Shevchenko
2022-04-11  8:33 ` [PATCH v3 02/12] serial: 8250: Handle UART without interrupt on TEMT Ilpo Järvinen
2022-04-11  8:33 ` [PATCH v3 03/12] serial: 8250_dwlib: RS485 HW half & full duplex support Ilpo Järvinen
2022-04-11  8:33 ` [PATCH v3 04/12] serial: 8250_dwlib: Implement SW half " Ilpo Järvinen
2022-04-11  8:33 ` [PATCH v3 05/12] dt_bindings: rs485: Add receiver enable polarity Ilpo Järvinen
2022-04-11  8:33 ` [PATCH v3 06/12] ACPI / property: Document RS485 _DSD properties Ilpo Järvinen
2022-04-11 11:02   ` Andy Shevchenko
2022-04-11  8:33 ` [PATCH v3 07/12] serial: termbits: ADDRB to indicate 9th bit addressing mode Ilpo Järvinen
2022-04-11  8:33   ` Ilpo Järvinen
2022-04-11  8:33   ` Ilpo Järvinen
2022-04-11  8:33 ` [PATCH v3 08/12] serial: General support for multipoint addresses Ilpo Järvinen
2022-04-11  8:33   ` Ilpo Järvinen
2022-04-11  8:33   ` Ilpo Järvinen
2022-04-11  8:33 ` [PATCH v3 09/12] serial: 8250: make saved LSR larger Ilpo Järvinen
2022-04-11  8:33 ` [PATCH v3 10/12] serial: 8250: create lsr_save_mask Ilpo Järvinen
2022-04-11  8:33 ` [PATCH v3 11/12] serial: 8250_lpss: Use 32-bit reads Ilpo Järvinen
2022-04-11 11:12   ` Andy Shevchenko
2022-04-11  8:33 ` [PATCH v3 12/12] serial: 8250_dwlib: Support for 9th bit multipoint addressing Ilpo Järvinen
2022-04-11 11:19   ` Andy Shevchenko
2022-04-21 15:36 ` [PATCH v3 00/12] Add RS485 support to DW UART Vicente Bergas
2022-04-21 19:38   ` Lukas Wunner
2022-04-21 20:41     ` Vicente Bergas
2022-04-22  9:25   ` Ilpo Järvinen
2022-04-22 13:07     ` Ilpo Järvinen
2022-04-23 23:57       ` Vicente Bergas
2022-04-25 11:16         ` Ilpo Järvinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.