From: Paul Walmsley <paul.walmsley@sifive.com>
To: Andreas Schwab <schwab@suse.de>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
linux-serial@vger.kernel.org, gregkh@linuxfoundation.org,
Paul Walmsley <paul@pwsan.com>, Jiri Slaby <jslaby@suse.com>,
Palmer Dabbelt <palmer@sifive.com>,
Wesley Terpstra <wesley@sifive.com>,
Julia Lawall <julia.lawall@lip6.fr>
Subject: Re: [PATCH v4 2/2] tty: serial: add driver for the SiFive UART
Date: Thu, 11 Apr 2019 14:13:24 -0700 (PDT) [thread overview]
Message-ID: <alpine.DEB.2.21.9999.1904111412210.19990@viisi.sifive.com> (raw)
In-Reply-To: <mvmtvf4ecvq.fsf@suse.de>
On Thu, 11 Apr 2019, Andreas Schwab wrote:
> 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.
Agreed. Thank you for your help debugging (some of which was off-list).
Clearly there should have been a build-test with lockdep enabled.
I will send a v5.
- Paul
next prev parent reply other threads:[~2019-04-11 21:13 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
2019-04-11 21:13 ` Paul Walmsley [this message]
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=alpine.DEB.2.21.9999.1904111412210.19990@viisi.sifive.com \
--to=paul.walmsley@sifive.com \
--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@pwsan.com \
--cc=schwab@suse.de \
--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
all inboxes | Powered by JetHome®