My system incorporates 7 serial ports on a custom board with the Zynq-7000. Two of the ports are two-wire RS485 and the processor has been given the control of the TX Enable lines to those two ports (using the N16550a IP core.) The problem I am having is that there appears to be data in the serial port internal FIFO when the write returns to Linux, so if I drop the TX line at that point, I am truncating the outgoing data. I've made it work, but simply waiting a few milliseconds (timing calculated by determining baud rate, number of bytes sent, ect.) Obviously this isn't the reliable way to do it. I want to handle the TX buffer emtpy interuprt from the 16550 to determine when it is safe to drop the tx enable. Can anyone provide some guidance on how to do this? We are using Ubuntu on core 0. I'm under a tight time constraint to get this working, so any help is greatly appreciated.
Below is the device tree entry for one of the 485 links: