mbox series

[v3,0/4] tty: serial: uartlite: Disable changing fixed parameters

Message ID 20210826192154.3202269-1-sean.anderson@seco.com
Headers show
Series tty: serial: uartlite: Disable changing fixed parameters | expand

Message

Sean Anderson Aug. 26, 2021, 7:21 p.m. UTC
The uartlite device is a "soft" device and certain parameters (such as
data bits, parity, and baud) are configured at synthesis time, and
cannot be discovered at runtime. Fortunately, bindings for this device
typically include some of these parameters (especially baud rate).
Instead of silently letting Linux's termios drift away from what the
hardware is actually doing, make the termios reflect the hardware, and
prevent them from being changed. With this series applied, the user
recieves an error message when they try to change these parameters:

    # stty parity
    stty: standard input: cannot perform all requested operations

Changes in v3:
- Use unevaluatedProperties: false instead of additionalProperties
- Removed defaults for required properties
- Remove warnings about unsupported termios
- Set defaults for xlnx,data-bits and xlnx,use-parity

Changes in v2:
- Compare the baud computed with uart_get_baud_rate to pdata->baud,
  instead of just checking c_cflag. This will catch anything that messes
  with ispeed and ospeed.
- Don't bother trying to set the initial termios. Instead, just skip
  warning if old is NULL.
- Because we no longer use uart_set_options, just convert the devicetree
  properties directly to clflags.

Sean Anderson (4):
  dt-bindings: serial: uartlite: Convert to json-schema
  dt-bindings: serial: uartlite: Add properties for synthesis-time
    parameters
  sh: j2: Update uartlite binding with data and parity properties
  tty: serial: uartlite: Prevent changing fixed parameters

 .../bindings/serial/xlnx,opb-uartlite.txt     | 23 -----
 .../bindings/serial/xlnx,opb-uartlite.yaml    | 90 ++++++++++++++++++
 arch/sh/boot/dts/j2_mimas_v2.dts              |  2 +
 drivers/tty/serial/uartlite.c                 | 91 ++++++++++++++++---
 4 files changed, 172 insertions(+), 34 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/serial/xlnx,opb-uartlite.txt
 create mode 100644 Documentation/devicetree/bindings/serial/xlnx,opb-uartlite.yaml