All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Yoshihiro Kaneko <ykaneko0929@gmail.com>, linux-serial@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Simon Horman <horms@verge.net.au>,
	Magnus Damm <magnus.damm@gmail.com>,
	linux-sh@vger.kernel.org
Subject: Re: [PATCH/RFC] serial: sh-sci: Update calculation of timeout for DMA
Date: Sun, 15 Mar 2015 15:30:58 +0000	[thread overview]
Message-ID: <5505A5B2.2020600@cogentembedded.com> (raw)
In-Reply-To: <1426429742-3041-1-git-send-email-ykaneko0929@gmail.com>

On 3/15/2015 5:29 PM, Yoshihiro Kaneko wrote:

> From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>

> The current calculation method in the case of 9600bps, rounding error occurs
> has become setting that occur timeout faster than the required time. When we
> use 9600bps, 32byte buffer, 10 bit (CS8) and 100 HZ, it becomes 3 jiffies
> (30msec). In fact it is necessary 33msec. This updates to the calculation
> that are not actually less than the value set by the rounding error.
> Also, this is nothing will be calculated value when there is no load. If there
> are a lot of case load, overrun error will occur immediately.
> This is by the buffer size to be calculated twice the DMA buffer, and add the
> change of setting a sufficient time-out value.

> Signedroff-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
> ---

> This patch is based on the tty-next branch of Greg Kroah-Hartman's tty
> tree.

>   drivers/tty/serial/sh-sci.c | 38 ++++++++++++++++++++++++++++++--------
>   1 file changed, 30 insertions(+), 8 deletions(-)

> diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
> index 5b50c79..891116c 100644
> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -1967,18 +1967,40 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
[...]
>   	if (s->chan_rx) {
> -		s->rx_timeout = (port->timeout - HZ / 50) * s->buf_len_rx * 3 /
> -			port->fifosize / 2;
> +		unsigned int bits;
> +
> +		/* byte size and parity */
> +		switch (termios->c_cflag & CSIZE) {
> +			case CS5:

    *case* should at the same indentation level as *switch*. I guess you 
haven't run the patch thru scripts/checkpatch.pl?

> +				bits = 7;
> +				break;
> +			case CS6:
> +				bits = 8;
> +				break;
> +			case CS7:
> +				bits = 9;
> +				break;
> +			default:
> +				bits = 10;
> +				break;
> +		}
[...]

WBR, Sergei


WARNING: multiple messages have this Message-ID (diff)
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Yoshihiro Kaneko <ykaneko0929@gmail.com>, linux-serial@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Simon Horman <horms@verge.net.au>,
	Magnus Damm <magnus.damm@gmail.com>,
	linux-sh@vger.kernel.org
Subject: Re: [PATCH/RFC] serial: sh-sci: Update calculation of timeout for DMA
Date: Sun, 15 Mar 2015 18:30:58 +0300	[thread overview]
Message-ID: <5505A5B2.2020600@cogentembedded.com> (raw)
In-Reply-To: <1426429742-3041-1-git-send-email-ykaneko0929@gmail.com>

On 3/15/2015 5:29 PM, Yoshihiro Kaneko wrote:

> From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>

> The current calculation method in the case of 9600bps, rounding error occurs
> has become setting that occur timeout faster than the required time. When we
> use 9600bps, 32byte buffer, 10 bit (CS8) and 100 HZ, it becomes 3 jiffies
> (30msec). In fact it is necessary 33msec. This updates to the calculation
> that are not actually less than the value set by the rounding error.
> Also, this is nothing will be calculated value when there is no load. If there
> are a lot of case load, overrun error will occur immediately.
> This is by the buffer size to be calculated twice the DMA buffer, and add the
> change of setting a sufficient time-out value.

> Signedroff-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
> ---

> This patch is based on the tty-next branch of Greg Kroah-Hartman's tty
> tree.

>   drivers/tty/serial/sh-sci.c | 38 ++++++++++++++++++++++++++++++--------
>   1 file changed, 30 insertions(+), 8 deletions(-)

> diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
> index 5b50c79..891116c 100644
> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -1967,18 +1967,40 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
[...]
>   	if (s->chan_rx) {
> -		s->rx_timeout = (port->timeout - HZ / 50) * s->buf_len_rx * 3 /
> -			port->fifosize / 2;
> +		unsigned int bits;
> +
> +		/* byte size and parity */
> +		switch (termios->c_cflag & CSIZE) {
> +			case CS5:

    *case* should at the same indentation level as *switch*. I guess you 
haven't run the patch thru scripts/checkpatch.pl?

> +				bits = 7;
> +				break;
> +			case CS6:
> +				bits = 8;
> +				break;
> +			case CS7:
> +				bits = 9;
> +				break;
> +			default:
> +				bits = 10;
> +				break;
> +		}
[...]

WBR, Sergei


  reply	other threads:[~2015-03-15 15:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-15 14:29 [PATCH/RFC] serial: sh-sci: Update calculation of timeout for DMA Yoshihiro Kaneko
2015-03-15 14:29 ` Yoshihiro Kaneko
2015-03-15 15:30 ` Sergei Shtylyov [this message]
2015-03-15 15:30   ` Sergei Shtylyov
2015-03-16 13:58   ` Yoshihiro Kaneko
2015-03-16 13:58     ` Yoshihiro Kaneko

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=5505A5B2.2020600@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=horms@verge.net.au \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=ykaneko0929@gmail.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.