linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
To: Sugaya Taichi <sugaya.taichi@socionext.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>, Arnd Bergmann <arnd@arndb.de>,
	Takao Orito <orito.takao@socionext.com>,
	Kazuhiro Kasai <kasai.kazuhiro@socionext.com>,
	Shinji Kanematsu <kanematsu.shinji@socionext.com>,
	Jassi Brar <jaswinder.singh@linaro.org>,
	Masami Hiramatsu <masami.hiramatsu@linaro.org>,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH v3] serial: Add Milbeaut serial control
Date: Fri, 26 Apr 2019 19:15:15 +0100	[thread overview]
Message-ID: <20190426191515.757e6015@alans-desktop> (raw)
In-Reply-To: <1555555916-22251-1-git-send-email-sugaya.taichi@socionext.com>

O
> +static void mlb_usio_set_termios(struct uart_port *port,
> +			struct ktermios *termios, struct ktermios *old)
> +{
> +	unsigned int escr, smr = MLB_USIO_SMR_SOE;
> +	unsigned long flags, baud, quot;
> +
> +	switch (termios->c_cflag & CSIZE) {
> +	case CS5:
> +		escr = MLB_USIO_ESCR_L_5BIT;
> +		break;
> +	case CS6:
> +		escr = MLB_USIO_ESCR_L_6BIT;
> +		break;
> +	case CS7:
> +		escr = MLB_USIO_ESCR_L_7BIT;
> +		break;
> +	case CS8:
> +	default:
> +		escr = MLB_USIO_ESCR_L_8BIT;
> +		break;
> +	}
> +
> +	if (termios->c_cflag & CSTOPB)
> +		smr |= MLB_USIO_SMR_SBL;
> +
> +	if (termios->c_cflag & PARENB) {
> +		escr |= MLB_USIO_ESCR_PEN;
> +		if (termios->c_cflag & PARODD)
> +			escr |= MLB_USIO_ESCR_P;
> +	}

If you don't suport CMSPAR then clear that bit in termios as well

> +	/* Set hard flow control */
> +	if (of_property_read_bool(port->dev->of_node, "auto-flow-control") ||
> +			(termios->c_cflag & CRTSCTS))
> +		escr |= MLB_USIO_ESCR_FLWEN;

That's just broken. The termios bits are the definitive things for the
port, and in addition even if they are forced you need to correct the
termios data.

You might want to control flow control *at boot* with an OF property but
doing it post boot is just busted.

Alan

  parent reply	other threads:[~2019-04-26 18:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-18  2:51 [PATCH v3] serial: Add Milbeaut serial control Sugaya Taichi
2019-04-18  5:17 ` Greg Kroah-Hartman
2019-04-18  6:09   ` Sugaya, Taichi
2019-04-26 18:15 ` Alan Cox [this message]
2019-05-08 12:22   ` Sugaya, Taichi

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=20190426191515.757e6015@alans-desktop \
    --to=gnomes@lxorguk.ukuu.org.uk \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jaswinder.singh@linaro.org \
    --cc=jslaby@suse.com \
    --cc=kanematsu.shinji@socionext.com \
    --cc=kasai.kazuhiro@socionext.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=masami.hiramatsu@linaro.org \
    --cc=orito.takao@socionext.com \
    --cc=sugaya.taichi@socionext.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).