From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Anton Vorontsov <avorontsov@ru.mvista.com>
Cc: Alan Cox <alan@linux.intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 8250: Now honours baud rate lower bounds
Date: Thu, 2 Jul 2009 22:53:12 +0100 [thread overview]
Message-ID: <20090702225312.02f78ec4@lxorguk.ukuu.org.uk> (raw)
In-Reply-To: <20090702213624.GA23193@oksana.dev.rtsoft.ru>
On Fri, 3 Jul 2009 01:36:24 +0400
Anton Vorontsov <avorontsov@ru.mvista.com> wrote:
> A platform clock drives 8250 ports in most SOC systems, the clock
> might run at high frequencies, and so it's not always possible to
> downscale uart clock to a desired value.
> This patch fixes the issue by passing minimum baud rate to the
> uart_get_baud_rate() call, the call should take care of all bounds,
> so userspace should now report:
We ought to be able to deduce the minimum baud rate from the divisor
being bigger than the chip supports - or do some of these devices not
support the full hw divisor range of the real chip which is what I assume
from your patch ?
> +static unsigned int _serial_dl_max(struct uart_8250_port *up)
> +{
> + return 0xffff;
> +}
> +
We have far too many magic ifdef routines for this sort of stuff already.
Is there any reason we can't put info on the true divisor or at least the
baud rate range into the uart_8250_port structure so that we get rid of
all of
> +static unsigned int serial_dl_max(struct uart_8250_port *up)
> +{
> + if (up->port.iotype == UPIO_AU)
> + return 0xffffffff;
> + else
> + return _serial_dl_max(up);
> +}
> #elif defined(CONFIG_SERIAL_8250_RM9K)
> static int serial_dl_read(struct uart_8250_port *up)
> {
> @@ -602,9 +615,15 @@ static void serial_dl_write(struct uart_8250_port *up, int value)
> _serial_dl_write(up, value);
> }
> }
> +
> +static unsigned int serial_dl_max(struct uart_8250_port *up)
> +{
> + return _serial_dl_max(up);
> +}
> #else
> #define serial_dl_read(up) _serial_dl_read(up)
> #define serial_dl_write(up, value) _serial_dl_write(up, value)
> +#define serial_dl_max(up) _serial_dl_max(up)
> #endif
>
> /*
> @@ -2272,7 +2291,9 @@ serial8250_set_termios(struct uart_port *port, struct ktermios *termios,
> /*
> * Ask the core to calculate the divisor for us.
> */
> - baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
> + baud = uart_get_baud_rate(port, termios, old,
> + port->uartclk / 16 / serial_dl_max(up),
> + port->uartclk / 16);
> quot = serial8250_get_divisor(port, baud);
in favour of
uart_get_baud_rate(port, termios, old, port->uartclk / 16,
port->uartclk / 16 / port->uartdivider)
Alan
next prev parent reply other threads:[~2009-07-02 21:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-02 21:36 Anton Vorontsov
2009-07-02 21:53 ` Alan Cox [this message]
2009-07-02 22:30 ` [PATCH v2] " Anton Vorontsov
2009-07-03 9:39 ` Alan Cox
2009-08-19 0:05 ` Anton Vorontsov
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=20090702225312.02f78ec4@lxorguk.ukuu.org.uk \
--to=alan@lxorguk.ukuu.org.uk \
--cc=akpm@linux-foundation.org \
--cc=alan@linux.intel.com \
--cc=avorontsov@ru.mvista.com \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®