public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: John Linn <john.linn@xilinx.com>
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	michal.simek@petalogix.com, joe@perches.com,
	grant.likely@secretlab.ca, greg@kroah.com
Subject: Re: [PATCH V3] tty/serial: add support for Xilinx PS UART
Date: Tue, 26 Apr 2011 20:58:09 +0100	[thread overview]
Message-ID: <20110426205809.39a96279@lxorguk.ukuu.org.uk> (raw)
In-Reply-To: <b33c1d76-c704-4b84-965b-97bc7e14f390@VA3EHSMHS030.ehs.local>

O
> +	if (percent_err >= 3)
> +		dev_err(port->dev, "Error too large, baud rate not set\n");

So in this cause baud isn't the one the user asked. Also the user can
make it spew errors by continually generating wrong rates.

If the error is large go for the nearest you can and return it. The core
tty code will do all the rest including reporting to the user they didn't
get their wishes.

> +	else {
> +		/* Set the values for the new baud rate */
> +		xuartps_writel(brgr_val, XUARTPS_BAUDGEN_OFFSET);
> +		xuartps_writel(brdiv_val, XUARTPS_BAUDDIV_OFFSET);

and in this it may not be exact.

I suspect this routine needs to return the actual baud rate (or maybe
baudrate/error code)


> +	/* Min baud rate = 6bps and Max Baud Rate is 10Mbps for 100Mhz clk */
> +	baud = uart_get_baud_rate(port, termios, old, 0, 10000000);
> +	xuartps_set_baud_rate(port, baud);
> +	if (tty_termios_baud_rate(termios))
> +		tty_termios_encode_baud_rate(termios, baud, baud);

and this should do something like

	baud = xuartps_set_baud_rate(port baud);

> +
> +	/*
> +	 * Update the per-port timeout.
> +	 */
> +	uart_update_timeout(port, termios->c_cflag, baud);

[which would also fix this timeout!]

Otherwise looks ready to merge

  reply	other threads:[~2011-04-26 19:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-22 19:13 [PATCH V3] tty/serial: add support for Xilinx PS UART John Linn
2011-04-26 19:58 ` Alan Cox [this message]
     [not found] <342576875.1870580.1303826202211.JavaMail.root@sz0140a.emeryville.ca.mail.comcast.net>
2011-04-26 14:18 ` johnlinn
2011-04-26 19:47   ` Greg KH
2011-04-26 21:19     ` johnlinn
     [not found] <381805170.1906645.1303859011392.JavaMail.root@sz0140a.emeryville.ca.mail.comcast.net>
2011-04-26 23:15 ` johnlinn
2011-04-27  9:33   ` Alan Cox
2011-04-27 13:21     ` johnlinn
2011-04-27 14:15       ` 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=20110426205809.39a96279@lxorguk.ukuu.org.uk \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=grant.likely@secretlab.ca \
    --cc=greg@kroah.com \
    --cc=joe@perches.com \
    --cc=john.linn@xilinx.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=michal.simek@petalogix.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