All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Korsgaard <jacmet@sunsite.dk>
To: monstr@monstr.eu
Cc: Grant Likely <grant.likely@secretlab.ca>, linux-serial@vger.kernel.org
Subject: Re: Uartlite - ulite_transmit
Date: Wed, 12 Jan 2011 10:40:08 +0100	[thread overview]
Message-ID: <87ei8izchz.fsf@macbook.be.48ers.dk> (raw)
In-Reply-To: <4D26C538.3010101@monstr.eu> (Michal Simek's message of "Fri, 07 Jan 2011 08:48:08 +0100")

>>>>> "Michal" == Michal Simek <monstr@monstr.eu> writes:

Hi,

 Michal> I looked at that loop and I think that we should reread actual
 Michal> status before ulite_transmit because status reg can be changed
 Michal> when ulite_receive is executed. What do you think? (BTW: status
 Michal> reading can be moved directly to ulite_receive/transmit
 Michal> functions)

 Michal>     do {
 Michal>         int stat = ioread32be(port->membase + ULITE_STATUS);
 Michal>         busy  = ulite_receive(port, stat);
 Michal>         stat = ioread32be(port->membase + ULITE_STATUS); // check
 Michal> status again
 Michal>         busy |= ulite_transmit(port, stat);
 Michal>         n++;
 Michal>     } while (busy);

It shouldn't really matter - ulite_transmit() only looks at TXFULL, and
in the unlikely case where it was full but 1 character got transmitted
during ulite_receive, we will catch it during the 2nd iteration of the
loop (as busy will be true).

The logic was afaik more-or-less directly copied from 8250.c

 Michal> 1. Before fault happen:
 Michal> ISR is called, status is 0x18 (interrupt enabled, tx fifo full) just
 Michal> to ulite_transmit and detect TXFULL and return to ISR. Head and tail
 Michal> are correct
 Michal> 2. Broken part
 Michal> ISR is called, status is 0x14 (interrupt enabled, tx fifo empty), jump
 Michal> to ulite_transmit. Here I am printing (head and tail values are
 Michal> zero). Xmit buffer address is the same. Then uart_circ_empty(xmit)
 Michal> detects that head and tail are the same which means nothing to print.

 Michal> My question: Is there any part of the code which can change xmit head
 Michal> and tail values?

Yes, ulite_transmit does (for tail). head is only changed by the serial core.

 Michal> BTW: Getty is providing that login prompt. Could it be an issue with getty?

Maybe. Or the fact that it calls set_termios or similar. Are you unable
to reproduce the problem with other programs?

-- 
Bye, Peter Korsgaard

      parent reply	other threads:[~2011-01-12  9:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4D2465E0.2000707@monstr.eu>
2011-01-05 12:39 ` Uartlite - ulite_transmit Michal Simek
2011-01-06  7:56   ` Peter Korsgaard
2011-01-06  8:29     ` Michal Simek
2011-01-06  9:02       ` Peter Korsgaard
2011-01-06  9:10         ` Michal Simek
2011-01-06  9:49           ` Peter Korsgaard
2011-01-07  7:48             ` Michal Simek
2011-01-07  9:06               ` Michal Simek
     [not found]                 ` <4D2D78F3.2040903@monstr.eu>
     [not found]                   ` <87aaj6zays.fsf@macbook.be.48ers.dk>
     [not found]                     ` <4D2D8113.1020504@monstr.eu>
     [not found]                       ` <8739oyza2n.fsf@macbook.be.48ers.dk>
2011-01-16  9:08                         ` Michal Simek
2011-01-16  9:08                           ` Michal Simek
2011-01-16 21:02                           ` Peter Korsgaard
2011-01-17  6:35                             ` Michal Simek
2011-01-17 15:17                             ` Michal Simek
2011-01-19 15:27                               ` Peter Korsgaard
2011-01-20  8:04                                 ` Michal Simek
2011-01-20  8:06                                   ` Peter Korsgaard
2011-01-20  8:08                                     ` Michal Simek
2011-01-12  9:40               ` Peter Korsgaard [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ei8izchz.fsf@macbook.be.48ers.dk \
    --to=jacmet@sunsite.dk \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-serial@vger.kernel.org \
    --cc=monstr@monstr.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.