All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Janusz Użycki" <j.uzycki@elpromaelectronics.com>
To: Fabio Estevam <festevam@gmail.com>,
	Stefan Wahren <stefan.wahren@i2se.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>,
	Janusz Uzycki <j.uzycki@elproma.com.pl>,
	Fabio Estevam <fabio.estevam@freescale.com>,
	Juergen Beisert <jbe@pengutronix.de>,
	"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH RFC] serial: mxs-auart: fix baud rate range
Date: Mon, 10 Aug 2015 19:01:27 +0200	[thread overview]
Message-ID: <55C8D8E7.9090103@elpromaelectronics.com> (raw)
In-Reply-To: <CAOMZO5CscLv+v=8QA-zchR3EeNogpwGRRARJo8qPROLwcBXTUg@mail.gmail.com>



W dniu 2015-08-10 o 14:22, Fabio Estevam pisze:
> On Mon, Aug 10, 2015 at 9:12 AM, Stefan Wahren <stefan.wahren@i2se.com> wrote:
>
>>          /* set baud rate */
>> -       baud = uart_get_baud_rate(u, termios, old, 0, u->uartclk);
>> +       baud_min = u->uartclk * 32 / 0x3fffc0;
>> +       baud_max = u->uartclk * 32 / 0xec;
>> +       baud = uart_get_baud_rate(u, termios, old, baud_min, baud_max);
> Looks good. It would be nice to replace 0x3fffc0 and 0xec with defines though.

I agree with Fabio.

In addition let's look at the example for uartclk = 24MHz:
baud_max = 3,254,237.29 => will be rounded down to 3,254,237bauds and it 
is OK
baud_min = 183.1 => will be rounded to 183 bauds. To avoid div=0x400971 
it should be 184
so DIV_ROUND_UP() macro could be used.

best regards
Janusz

>
> Regards,
>
> Fabio Estevam

  reply	other threads:[~2015-08-10 17:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-10 12:12 [PATCH RFC] serial: mxs-auart: fix baud rate range Stefan Wahren
2015-08-10 12:12 ` Stefan Wahren
2015-08-10 12:22 ` Fabio Estevam
2015-08-10 17:01   ` Janusz Użycki [this message]
2015-08-11  7:14     ` Stefan Wahren

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=55C8D8E7.9090103@elpromaelectronics.com \
    --to=j.uzycki@elpromaelectronics.com \
    --cc=fabio.estevam@freescale.com \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=j.uzycki@elproma.com.pl \
    --cc=jbe@pengutronix.de \
    --cc=jslaby@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=stefan.wahren@i2se.com \
    /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.