linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Paul Walmsley <paul@pwsan.com>,
	Wesley Terpstra <wesley@sifive.com>,
	gregkh@linuxfoundation.org, Palmer Dabbelt <palmer@sifive.com>,
	linux-kernel@vger.kernel.org, Julia Lawall <julia.lawall@lip6.fr>,
	linux-serial@vger.kernel.org, Jiri Slaby <jslaby@suse.com>,
	linux-riscv@lists.infradead.org
Subject: Re: [PATCH v4 2/2] tty: serial: add driver for the SiFive UART
Date: Thu, 11 Apr 2019 18:16:09 +0200	[thread overview]
Message-ID: <mvmtvf4ecvq.fsf@suse.de> (raw)
In-Reply-To: <20190411090027.8670-3-paul.walmsley@sifive.com> (Paul Walmsley's message of "Thu, 11 Apr 2019 02:00:30 -0700")

On Apr 11 2019, Paul Walmsley <paul.walmsley@sifive.com> wrote:

> +static void sifive_serial_set_termios(struct uart_port *port,
> +				      struct ktermios *termios,
> +				      struct ktermios *old)
> +{
> +	struct sifive_serial_port *ssp = port_to_sifive_serial_port(port);
> +	unsigned long flags;
> +	u32 v, old_v;
> +	int rate;
> +	char nstop;
> +
> +	if ((termios->c_cflag & CSIZE) != CS8) {
> +		dev_err(ssp->port.dev, "only 8-bit words supported\n");
> +		return;
> +	}
> +
> +	/* Set number of stop bits */
> +	nstop = (termios->c_cflag & CSTOPB) ? 2 : 1;
> +	__ssp_set_stop_bits(ssp, nstop);
> +
> +	/* Set line rate */
> +	rate = uart_get_baud_rate(port, termios, old, 0, ssp->clkin_rate / 16);
> +	__ssp_update_baud_rate(ssp, rate);
> +
> +	spin_lock_irqsave(&ssp->port.lock, flags);
> +
> +	/*
> +	 * Update the per-port timeout.
> +	 */
> +	uart_update_timeout(port, termios->c_cflag, rate);
> +
> +	ssp->port.read_status_mask = 0;
> +	if (termios->c_iflag & INPCK) {
> +		dev_err(ssp->port.dev, "INPCK flag not supported\n");
> +		goto ssst_out;
> +	}
> +	if (termios->c_iflag & (BRKINT | PARMRK)) {
> +		dev_err(ssp->port.dev, "BRKINT/PARMRK flag not supported\n");
> +		goto ssst_out;
> +	}

I don't think it is a good idea to print something while the port is
locked.

And I think set_termios is supposed to apply all applicable settings,
even if some of them are not supported.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2019-04-11 16:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-11  9:00 [PATCH v4 0/2] tty: serial: add DT bindings and serial driver for the SiFive FU540 UART Paul Walmsley
2019-04-11  9:00 ` [PATCH v4 1/2] dt-bindings: serial: add documentation for the SiFive UART driver Paul Walmsley
2019-04-11  9:00 ` [PATCH v4 2/2] tty: serial: add driver for the SiFive UART Paul Walmsley
2019-04-11 16:16   ` Andreas Schwab [this message]
2019-04-11 21:13     ` Paul Walmsley
2019-04-11 21:14   ` Atish Patra

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=mvmtvf4ecvq.fsf@suse.de \
    --to=schwab@suse.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=palmer@sifive.com \
    --cc=paul.walmsley@sifive.com \
    --cc=paul@pwsan.com \
    --cc=wesley@sifive.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;
as well as URLs for NNTP newsgroup(s).