On Tue, Mar 10, 2009 at 7:53 PM, Mike Frysinger <vapier.adi@gmail.com> wrote:
On Tue, Mar 10, 2009 at 07:48, gyang wrote:
> On Tue, 2009-03-10 at 19:25 +0800, graff yang wrote:
>> On Tue, Mar 10, 2009 at 4:03 PM, Mike Frysinger wrote:
>>> On Tue, Mar 10, 2009 at 03:29,  <graff.yang@gmail.com> wrote:
>>>> +               do {
>>>> +                       lsr = SIR_UART_GET_LSR(port);
>>>> +               } while (!(lsr & TEMT));
>>
>>
>>> i'm pretty sure we determined that it is not the job of the
>>> kernel to
>>> make sure the line is clear before we go changing speeds.
>
> But we should prevent changing speed when the byte is sending out.

no we shouldnt.  if the user changes speeds while things are being
transmitted, then they screwed up.  this is why tcdrain/tcflush exist
on the tty side of things.
 
This  bfin_sir_set_speed() function is only called by driver its self.
In one irda session, driver may use 9600 to negotiation, then use 57600 to transmit mass data.
I don't very sure about whether there is a mechanism in the upper layer to prevent changing speed when the bytes in our FIFO is sending out.

As I know, irtty+uart have such mechanism. We need call uart_update_timeout() to tell upper layer the timeout for our FIFO to drain.


-mike