Linux Serial subsystem development
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Martin Fuzzey <mfuzzey@parkeon.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-serial@vger.kernel.org
Subject: Re: [PATCH] TTY: serial 8250: Support MCR CLK_SEL bit.
Date: Mon, 19 Nov 2012 12:00:43 +0000	[thread overview]
Message-ID: <20121119120043.39f59baf@pyramind.ukuu.org.uk> (raw)
In-Reply-To: <20121119085421.315.47347.stgit@localhost>

>     * Allows the CLK_SEL bit to be forced to /1, /4 or left as is.

This seems to be the wrong place to set such stuff. The kernel knows what
speed is selected and therefore what clock would be best.

Having a clocksel (and probably an of value indicating which type of
clock sel) is a good thing, but it also ought to be set based on the
requested baud rate, so a custom set_termios would be better.

That would also handle serial console, and suspend/resume without other
tweaks as far as I can see.

It also seems some devices use different clksel algorithms so rather than
a CAP_CLKSEL flag we probably need to key it off the uart type.


>  static void serial8250_set_sleep(struct uart_8250_port *p, int sleep)
>  {
>  	if (p->capabilities & UART_CAP_SLEEP) {
> -		if (p->capabilities & UART_CAP_EFR) {
> -			serial_out(p, UART_LCR, UART_LCR_CONF_MODE_B);
> -			serial_out(p, UART_EFR, UART_EFR_ECB);
> -			serial_out(p, UART_LCR, 0);
> -		}
> +		serial8250_enable_extended(p);
>  		serial_out(p, UART_IER, sleep ? UART_IERX_SLEEP : 0);

This seems wrong if theere is no EFR

> +static int serial8250_configure_clock_predivisor(struct uart_8250_port *p)
> +{

Ought to be named to reflect that it appears to be exar specific

Architecturally the patch seems wrong though. I'd expect a device with a
clock predivisor to be treated as a device with a wider clock range and
just handle it when the speed is set. Eg wrapping set_termios or adding a 

	->select_clock(port, bitrate);

helper.

Alan

  reply	other threads:[~2012-11-19 11:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-19  8:54 [PATCH] TTY: serial 8250: Support MCR CLK_SEL bit Martin Fuzzey
2012-11-19 12:00 ` Alan Cox [this message]
2012-11-20  9:55   ` Martin Fuzzey
2012-11-20 16:23     ` Alan Cox

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=20121119120043.39f59baf@pyramind.ukuu.org.uk \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mfuzzey@parkeon.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox