Re: [PATCH v7] serial: support for 16550A serial ports on LP-8x4x

From: Sergei Ianovich
Date: Tue Mar 01 2016 - 14:28:25 EST


On Tue, 2016-03-01 at 19:48 +0200, Andy Shevchenko wrote:
> On Tue, 2016-03-01 at 20:14 +0300, Sergei Ianovich wrote:
> > On Tue, 2016-03-01 at 18:46 +0200, Andy Shevchenko wrote:
> > > On Tue, 2016-03-01 at 19:25 +0300, Sergei Ianovich wrote:
> > > > On Tue, 2016-03-01 at 13:06 +0200, Andy Shevchenko wrote:
> > > > > On Tue, 2016-03-01 at 00:26 +0300, Sergei Ianovich wrote:
>
> > > So, but if you support only fixed rates, why do you care about
> > > BOTHER
> > > at all?
> >
> > If BOTHER is defined,Âtty_termios_baud_rate()
> > andÂtty_termios_encode_baud_rate() allow non-standard baud rates. I
> > should clear it fromÂc_cflag to indicate I don't support it.
> >
> > > > > > Â
> > > > > I think you can call this unconditionally together with case
> > > > > >
> > > > > 115200.
> > > >
> > > > The calls are orthogonal. This one deals with the case when
> > > > BOTHER
> > > > is
> > > > defined and set, and we have non-zero rate with BOTHER, but we
> > > > have
> > > > zero rate after BOTHER is cleared. So we set 9600 as a sane
> > > > default
> > > > speed.
>
> Maybe you just set a baud rate nearest to the one from the table in
> case of BOTHER?
>
> In that case perhaps you have to supply +-1 to the range. That's why
> I
> asked aboutÂuart_get_baud_rate().Â
>
> Maybe this flow will work for you
>
> if (BOTHER)
> Âclear BOTHER
> ÂcallÂuart_get_baud_rate()
>
> ?

It works well for standard rates, let it be so. If there ever is a
problem, we can fix it.