serial: 8250_ni: new driver for NI UARTs#100
serial: 8250_ni: new driver for NI UARTs#100bstreiff wants to merge 4 commits intoni:nilrt/master/6.0from
Conversation
|
@ni/rtos |
|
also pinging @sjasonsmith who also expressed a desire to look at this but whom I cannot seem to add as a reviewer |
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. |
gratian
left a comment
There was a problem hiding this comment.
Pending @sjasonsmith approval before merging.
sjasonsmith
left a comment
There was a problem hiding this comment.
Approve from my perspective. I can't verify that the details of all the different ACPI IDs is correct.
Wire modes will need to be revisited later.
7a39588 to
75a6caa
Compare
|
changes in v2:
|
|
I've reset approvals in order to review v2. |
sjasonsmith
left a comment
There was a problem hiding this comment.
I consider my comments pretty minor, and I'm fine with what you decide is the proper reaction to them.
I'm not 100% of GitHub workflows. I'm marking this as "Request Changes" but my intent is that after you read my comments you can decide how to proceed and do so without having to wait on me.
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. Originally by: Jaeden Amero <jaeden.amero@ni.com> Originally by: Karthik Manamcheri <karthik.manamcheri@ni.com> Modified extensively to move enumeration and other logic into a self-contained platform_driver instead of being shoved into 8250_pnp. Signed-off-by: Brenda Streiff <brenda.streiff@ni.com>
Add bindings for the NI 16550 UART. Signed-off-by: Brenda Streiff <brenda.streiff@ni.com>
Switch to using the new 8250_ni UART implementation. Signed-off-by: Brenda Streiff <brenda.streiff@ni.com>
We added an interface in 8e9e459 ("8250: Allow client drivers to control tranceivers") for RS-485 transceiver control, but this never went upstream and is also not a requirement for a client driver to implement RS-485 transceiver control. However, this out-of-tree interface got exposed to the NI-Serial drivers, and they were using it for their driver for the NI 987x devices, so we can't (yet) drop it outright. Mark this interface as deprecated and emit a warning when registering a client driver that intends to use it. Upstream-Status: Inappropriate [NI-specific] Signed-off-by: Brenda Streiff <brenda.streiff@ni.com>
75a6caa to
840baca
Compare
|
v3 drops the rts delay stuff out of the rs485-supported struct. |
|
Merged into |
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:
CONFIG_SERIAL_8250_NIinstead ofCONFIG_SERIAL_8250_NI16550-- this lets the two implementations live side-by-side in our tree (rationale below)platform_deviceinstead of a pile of custom initialization bodged into the8250_pnpcode. This pushes more of the NI16550-specific code into its own file (and reducing future merge conflicts)platform_device, on x64, device enumeration happens a little bit differently than enumeration via the legacy PNP system. This should be invisible to most users unless they go digging real hard in sysfs ($(realpath /sys/class/tty/ttyS1)on a cRIO-904x becomes/sys/devices/pci0000:00/0000:00:1f.0/NIC792B:00/tty/ttyS1instead of/sys/devices/pnp0/00:01/tty/ttyS1-- however most users are probably just going to be using/dev/ttyS1, which doesn't change.)PORT_NI16550_*is gone; we just usePORT_16550A. This is a visible change to userspace (/sys/class/ttyS1/typeand also viaserial_struct::typewith theTIOCGSERIALioctl), but userspace could not rely on the values we had been using anyway (since we had to keep renumbering on every kernel upgrade). Note that use of this field for identification purposes seems to have fallen out of fashion-- in fact for USB serial devices as of f64d74a they all just returnPORT_UNKNOWN.NI_16BYTE_FIFOis gone now (as are the distinctni,ni16550-f16andni,ni16550-f128OF names)-- instead we look at theTFS/RFSregisters; these have been present in the common UART core since at least 2012, and if they're somehow not there, then 128 bytes seems fine as an assumption, since the single 16-byte-FIFO instantiation seems to have been the exception.NI_CAP_PMRhas a slightly more interesting tale-- it was added to the common core in 2014, shipped in the CVS product line, and then removed with no explanation in 2015. (Filed AzDO 2275198 to HW about that.) At any rate, in the current version of the register map, that register is now no longer reserved and there's risk that it could be reused for some future purpose, so we have to keep the magic flag. :(ni,ni16550OF ID becausecheckpatch.plcomplains about it.checkpatch.plalso complains if you don't put it in its own commit, which is why it's separated. I didn't actually try to give this a spin on a device using OF-based enumeration (aka Zynq-based cRIO) due to the effort involved in getting this version of the driver working with the current Zynq kernel.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 fdc2de8 ("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.