Re: Issue with XR17V35X

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have fixed the problem for my use-case with the following patch to
not clear the FIFOs if there is still data to be transmitted:

diff --git a/drivers/tty/serial/8250/8250_port.c
b/drivers/tty/serial/8250/8250_port.c
index d2f3310abe54..569a76d1b00a 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -2441,7 +2441,10 @@ void serial8250_do_shutdown(struct uart_port *port)
      */
     serial_port_out(port, UART_LCR,
             serial_port_in(port, UART_LCR) & ~UART_LCR_SBC);
-    serial8250_clear_fifos(up);
+    if (serial_in(up, UART_LSR) & UART_LSR_TEMT){
+        /* Check if transmitter is empty before clearing FIFOs */
+        serial8250_clear_fifos(up);
+    }

 #ifdef CONFIG_SERIAL_8250_RSA
     /*

I'm not sure if this is correct/the best way to do it, since I am not
sure if this is common to all drivers under 8250 or only for the Exar
chip.  I can also provide a proper patch via e-mail if that makes
sense.

-Robert Middleton

On Thu, Jun 27, 2019 at 6:54 PM Robert Middleton
<robert.middleton@xxxxxxxxxx> wrote:
>
> Hi all,
>
> I've encountered a problem with the driver for the XR17V358
> PCIe-to-serial converter.  When I try to send data to the chip, it is
> only transmitted properly if I am also reading from the tty at the
> same point.  That is the following sequence in the terminal works:
>
> cat /dev/ttyS13 &
> echo "this is a test" > /dev/ttyS13
>
> The data "this is a test" will be sent correctly out the serial port.
> However, if I don't cat it and do just the following:
>
> echo "this is a test" > /dev/ttyS13
>
> then I will occasionally get the first character('t'), occasionally
> nothing, but never the entire message and never more than one byte.
>
> I tried to track this down earlier today, but I haven't been able to
> figure out where exactly it is going wrong.  Has anybody else seen
> this?  Does anybody know what exactly to look for to fix this?  I was
> poking around alot in 8250_port.c, since that seems to be where most
> of this is happening, but I wasn't sure if this is an exar-specific
> thing or if it is a problem with all 16550-compatible UARTs.
>
> -Robert Middleton



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux