Jurgen Martin

Linux UART driver for 5475 loses data

Discussion created by Jurgen Martin on Sep 17, 2008
Latest reply on Sep 22, 2008 by Jurgen Martin
Hi !

I am using the Linux 2.6.10 kernel and finding that the UART driver seems to lose data whenever the receive buffer (flip buffer) is full. The interrupt routine receive_chars() in drivers/serial/mcfserial.c had the following code:

static _INLINE_ void receive_chars(struct mcf_serial *info,
  volatile unsigned char *uartp)
  struct tty_struct *tty = info->tty;
  unsigned char  status, ch;
  if (!tty)

  while ((status = uartp[MCFUART_USR]) & MCFUART_USR_RXREADY) {
if (tty->flip.count >= TTY_FLIPBUF_SIZE) {
   * can't take any more data.  Turn off receiver
   * so that the interrupt doesn't continually
   * occur.
   info->imr &= ~MCFUART_UIR_RXREADY;        uartp[MCFUART_UIMR] = info->imr;
....  //process the character
  schedule_delayed_work(&tty->flip.work, 1);

 what I found is that the interrupts never get activated again so I changed it to:
if (tty->flip.count >= TTY_FLIPBUF_SIZE) {      break;}

When the interrupt completes it schedules the flipping of of the buffers  but  somehow even if I have RTS/CTS I still lose data.
I even  tried enabling low_latency for the driver and scheduling the work of flipping the buffers immediately using (at the end of the receive_chars() routine) :

 I have the following questions:
1. If the data is not read from the FIFO queue in the interrupt routine does it discard those characters?
2. Where would the interrupt be enabled again when the it is disabled in the interrupt handler?
3. Is there another suggestions of how to solve it?