ni / linux

Linux kernel source for NI Linux Real-Time
Other
80 stars 77 forks source link

serial: 8250_ni: new driver for NI UARTs #100

Closed bstreiff closed 1 year ago

bstreiff commented 1 year ago

The National Instruments (NI) 16550 is a standard 16550 with larger FIFOs and embedded RS-232/RS-485 transceiver control circuitry. This patch adds a driver that can operate this UART.


This patch set is a combination and reformulation of

There are significant differences between that pile of patches and what we have here, which is:

This is hopefully a lot cleaner and more upstream-acceptable-- but because it's a significant reworking, I'd like for it to simmer in our trees for a little bit to get some ATS runtime (in particular, get some testing on more than just a cRIO-904x with hand-testing with pyserial!). If it causes problems, we have a quick escape hatch (we can flip the kconfig token back)-- if it turns out good, then we can start tackling reverts on the older implementation.

You might also notice that "8250_ni" is named kind of generically-- I did consider trying to add support for PCI/PXI devices, at least to the extent of the since-reverted attempt in fdc2de87124f ("serial/8250: Add support for NI-Serial PXI/PXIe+485 devices."). I think this is viable to add to 8250_ni (the RS-232 control register looks the same, so this mostly amounts to "add PCI enumeration and num_ports/address offsetting)), but wouldn't be a total replacement for the NI-Serial ni843x driver (lack of DMA). Maybe later...

I went with citing Jaeden and Karthik as the original authors-- most of the other changes since then have been mostly-trivial adding of IDs and/or handling the effects of 8250 core changes. Let me know if you think that should change.

bstreiff commented 1 year ago

@ni/rtos

bstreiff commented 1 year ago

also pinging @sjasonsmith who also expressed a desire to look at this but whom I cannot seem to add as a reviewer

sjasonsmith commented 1 year ago

The generic "transceiver interface" that was added in the earliest patches is now gone-- transceiver enable/disable just happens in the port startup/shutdown callbacks now. Having that as a separate API might have been nice, but I think it'd only be justifiable if I ported other 8250 drivers to use it

I think that when this was originally created there were not yet upstream mechanisms for RS-485 configuration. It's role decreased as it was merged with newer kernel versions, until finally reaching complete obsolescence in this PR.

bstreiff commented 1 year ago

changes in v2:

gratian commented 1 year ago

I've reset approvals in order to review v2.

bstreiff commented 1 year ago

v3 drops the rts delay stuff out of the rs485-supported struct.

bstreiff commented 1 year ago

Merged into nilrt/master/6.0