From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Mathias Adam <a2@adamis.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 8250.c: Fix to make 16C950 UARTs work
Date: Fri, 9 Sep 2005 11:18:35 +0100 [thread overview]
Message-ID: <20050909111835.D17575@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20050909024926.GA13643@adamis.de>; from a2@adamis.de on Fri, Sep 09, 2005 at 04:49:27AM +0200
A couple of comments - see below.
On Fri, Sep 09, 2005 at 04:49:27AM +0200, Mathias Adam wrote:
> --- linux-2.6.13-org/drivers/serial/8250.c 2005-08-29 01:41:01.000000000 +0200
> +++ linux-2.6.13/drivers/serial/8250.c 2005-09-09 02:16:49.000000000 +0200
> @@ -1665,7 +1665,7 @@
> struct uart_8250_port *up = (struct uart_8250_port *)port;
> unsigned char cval, fcr = 0;
> unsigned long flags;
> - unsigned int baud, quot;
> + unsigned int baud, quot, max_baud;
>
> switch (termios->c_cflag & CSIZE) {
> case CS5:
> @@ -1697,9 +1697,28 @@
> /*
> * Ask the core to calculate the divisor for us.
> */
> - baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
> + max_baud = (up->port.type == PORT_16C950 ? port->uartclk/4 : port->uartclk/16);
> + baud = uart_get_baud_rate(port, termios, old, 0, max_baud);
> quot = serial8250_get_divisor(port, baud);
>
> + /*
> + * 16C950 supports additional prescaler ratios between 1:16 and 1:4
> + * thus increasing max baud rate to uartclk/4. The following was taken
> + * from kernel 2.4 by Mathias Adam <a2@adamis.de> to make the Socket
> + * Bluetooth CF Card work under 2.6.13.
> + */
> + if (up->port.type == PORT_16C950) {
> + unsigned int baud_base = port->uartclk/16;
baud_base appears unused.
> + if (baud <= port->uartclk/16)
> + serial_icr_write(up, UART_TCR, 0);
> + else if (baud <= port->uartclk/8) {
> + serial_icr_write(up, UART_TCR, 0x8);
> + } else if (baud <= port->uartclk/4) {
> + serial_icr_write(up, UART_TCR, 0x4);
> + } else
> + serial_icr_write(up, UART_TCR, 0);
baud can't be larger than port->uartclk/4 since you limited it above.
> + }
> +
> /*
> * Oxford Semi 952 rev B workaround
> */
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
next prev parent reply other threads:[~2005-09-09 10:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-09 1:31 [PATCH] 8250.c: Fix to make 16C950 UARTs work Mathias Adam
2005-09-09 1:58 ` Stefan Smietanowski
2005-09-09 2:49 ` Mathias Adam
2005-09-09 10:18 ` Russell King [this message]
2005-09-09 14:42 ` Mathias Adam
2005-09-16 12:11 ` Mathias Adam
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=20050909111835.D17575@flint.arm.linux.org.uk \
--to=rmk+lkml@arm.linux.org.uk \
--cc=a2@adamis.de \
--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