All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Cc: Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	Greg KH <gregkh@linuxfoundation.org>,
	Wolfram Sang <wsa@the-dreams.de>,
	"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
	Magnus Damm <magnus.damm@gmail.com>,
	Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Subject: Re: [PATCH v4 1/4] serial: sh-sci: increase RX FIFO trigger defaults for (H)SCIF
Date: Tue, 7 Feb 2017 15:40:13 +0100	[thread overview]
Message-ID: <CAMuHMdUPWx1REjEFKybEx48VbOtsLg=ZLkZb_g5VdFuSe793sA@mail.gmail.com> (raw)
In-Reply-To: <1486118300-12633-2-git-send-email-ulrich.hecht+renesas@gmail.com>

Hi Ulrich,

On Fri, Feb 3, 2017 at 11:38 AM, Ulrich Hecht
<ulrich.hecht+renesas@gmail.com> wrote:
> Sets reasonable trigger defaults for the various SCIF variants.
> Also corrects the FIFO size for SH7705-style ports.
>
> Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

This patch (which is now in tty-next) breaks serial console input on
systems with a SCIFA serial port (r8a73a4/ape6evm, r8a7740/armadillo,
and sh73a0/kzm9g).  Console input isn't received by the system, until
more characters have been accumulated in the FIFO than the trigger value
(32 on SCIFA), or until serial output is generated.

Unfortunately the later patches in this series do not fix this (except
by doing "echo 1 > /sys/class/tty/ttySC0/device/rx_fifo_trigger" manually).

SCIF serial consoles (on R-Car Gen2 and Gen3) seem to keep on working
fine.

> ---
>  drivers/tty/serial/sh-sci.c | 29 ++++++++++++++++++++++++++++-
>  1 file changed, 28 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
> index 050d028..520e344 100644
> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -148,6 +148,7 @@ struct sci_port {
>         struct timer_list               rx_timer;
>         unsigned int                    rx_timeout;
>  #endif
> +       int                             rx_trigger;
>
>         bool has_rtscts;
>         bool autorts;
> @@ -450,7 +451,7 @@ static const struct sci_port_params sci_port_params[SCIx_NR_REGTYPES] = {
>                         [SCFCR]         = { 0x18, 16 },
>                         [SCFDR]         = { 0x1c, 16 },
>                 },
> -               .fifosize = 16,
> +               .fifosize = 64,
>                 .overrun_reg = SCxSR,
>                 .overrun_mask = SCIFA_ORER,
>                 .sampling_rate_mask = SCI_SR(16),
> @@ -2062,6 +2063,7 @@ static void sci_reset(struct uart_port *port)
>  {
>         const struct plat_sci_reg *reg;
>         unsigned int status;
> +       struct sci_port *s = to_sci_port(port);
>
>         do {
>                 status = serial_port_in(port, SCxSR);
> @@ -2081,6 +2083,9 @@ static void sci_reset(struct uart_port *port)
>                 status &= ~(SCLSR_TO | SCLSR_ORER);
>                 serial_port_out(port, SCLSR, status);
>         }
> +
> +       if (s->rx_trigger > 1)
> +               scif_set_rtrg(port, s->rx_trigger);
>  }
>
>  static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
> @@ -2615,6 +2620,28 @@ static int sci_init_single(struct platform_device *dev,
>         if (unlikely(sci_port->params == NULL))
>                 return -EINVAL;
>
> +       switch (p->type) {
> +       case PORT_SCIFB:
> +               sci_port->rx_trigger = 48;
> +               break;
> +       case PORT_HSCIF:
> +               sci_port->rx_trigger = 64;
> +               break;
> +       case PORT_SCIFA:
> +               sci_port->rx_trigger = 32;
> +               break;
> +       case PORT_SCIF:
> +               if (p->regtype == SCIx_SH7705_SCIF_REGTYPE)
> +                       /* RX triggering not implemented for this IP */
> +                       sci_port->rx_trigger = 1;
> +               else
> +                       sci_port->rx_trigger = 8;
> +               break;
> +       default:
> +               sci_port->rx_trigger = 1;
> +               break;
> +       }
> +
>         /* SCIFA on sh7723 and sh7724 need a custom sampling rate that doesn't
>          * match the SoC datasheet, this should be investigated. Let platform
>          * data override the sampling rate for now.
> --
> 2.7.4

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2017-02-07 14:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-03 10:38 [PATCH v4 0/4] Renesas *SCIF* RX FIFO support Ulrich Hecht
2017-02-03 10:38 ` [PATCH v4 1/4] serial: sh-sci: increase RX FIFO trigger defaults for (H)SCIF Ulrich Hecht
2017-02-07 14:40   ` Geert Uytterhoeven [this message]
2017-02-03 10:38 ` [PATCH v4 2/4] serial: sh-sci: SCIFA/B RX FIFO software timeout Ulrich Hecht
2017-02-03 10:38 ` [PATCH v4 3/4] serial: sh-sci: make RX FIFO parameters tunable via sysfs Ulrich Hecht
2017-02-07 14:40   ` Geert Uytterhoeven
2017-02-08 10:04     ` Ulrich Hecht
2017-02-08 10:38       ` Geert Uytterhoeven
2017-02-12 16:04   ` Laurent Pinchart
2017-02-03 10:38 ` [PATCH v4 4/4] arm64: dts: r8a7796: salvator-x: add SCIF1 (DEBUG1) Ulrich Hecht
2017-02-08 10:54   ` Simon Horman
2017-02-08 11:19     ` Ulrich Hecht
2017-02-13 13:05       ` Simon Horman
2017-02-13 13:10         ` Geert Uytterhoeven

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='CAMuHMdUPWx1REjEFKybEx48VbOtsLg=ZLkZb_g5VdFuSe793sA@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=sergei.shtylyov@cogentembedded.com \
    --cc=ulrich.hecht+renesas@gmail.com \
    --cc=wsa@the-dreams.de \
    /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.