From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steffen Trumtrar Subject: Re: [PATCH] mxs: uart: allow setting RTS from software Date: Thu, 13 Dec 2012 09:40:17 +0100 Message-ID: <20121213084017.GA27832@pengutronix.de> References: <1355329913-27666-1-git-send-email-s.trumtrar@pengutronix.de> <50C93B6B.7090206@freescale.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from metis.ext.pengutronix.de ([92.198.50.35]:51445 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750819Ab2LMIkT (ORCPT ); Thu, 13 Dec 2012 03:40:19 -0500 Content-Disposition: inline In-Reply-To: <50C93B6B.7090206@freescale.com> Sender: linux-serial-owner@vger.kernel.org List-Id: linux-serial@vger.kernel.org To: Huang Shijie Cc: linux-serial@vger.kernel.org, stable@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Alan Cox Hi, On Thu, Dec 13, 2012 at 10:20:27AM +0800, Huang Shijie wrote: > =E4=BA=8E 2012=E5=B9=B412=E6=9C=8813=E6=97=A5 00:31, Steffen Trumtrar= =E5=86=99=E9=81=93: > > With the patch "serial: mxs-auart: fix the wrong RTS hardware flow = control" the > > mainline mxs-uart driver now sets RTSEN only when hardware flow con= trol is > > enabled via software. It is not possible any longer to set RTS manu= ally via > > software. However, the manual modification is a valid operation. > > Regain the possibility to set RTS via software and only set RTSEN w= hen hardware > Is there any user case to set the RTS via software? > I am confused at this. there are cases where the RTS is used in a non-standard way. And the al= ways-on hardware flowcontrol breaks these (e.g. Echelon FT5000). And as stated in the commit message, it is a valid operation to use sof= tware flow control. > > flow control is explicitly enabled via settermios cflag CRTSCTS. > > > > Signed-off-by: Steffen Trumtrar > > --- > > drivers/tty/serial/mxs-auart.c | 8 +++++++- > > 1 file changed, 7 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mx= s-auart.c > > index 6db23b0..9b62c4b 100644 > > --- a/drivers/tty/serial/mxs-auart.c > > +++ b/drivers/tty/serial/mxs-auart.c > > @@ -412,10 +412,12 @@ static void mxs_auart_set_mctrl(struct uart_p= ort *u, unsigned mctrl) > > =20 > > u32 ctrl =3D readl(u->membase + AUART_CTRL2); > > =20 > > - ctrl &=3D ~AUART_CTRL2_RTSEN; > > + ctrl &=3D ~(AUART_CTRL2_RTSEN | AUART_CTRL2_RTS); > > if (mctrl & TIOCM_RTS) { > > if (tty_port_cts_enabled(&u->state->port)) > > ctrl |=3D AUART_CTRL2_RTSEN; > > + else > > + ctrl |=3D AUART_CTRL2_RTS; > > } > > =20 > > s->ctrl =3D mctrl; > > @@ -678,6 +680,10 @@ static void mxs_auart_settermios(struct uart_p= ort *u, > > } > > ctrl2 |=3D AUART_CTRL2_CTSEN | AUART_CTRL2_RTSEN; > > } else { > > + u->flags |=3D ASYNC_CTS_FLOW; > > + ctrl2 |=3D AUART_CTRL2_CTSEN | AUART_CTRL2_RTSEN; > > + } else { > > + u->flags &=3D ~ASYNC_CTS_FLOW; > bug. >=20 > Your code adds TWO "else" here. >=20 Oops, wrong merge resolution. Will fix that. Regards, Steffen --=20 Pengutronix e.K. | = | Industrial Linux Solutions | http://www.pengutronix.de/= | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 = | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-555= 5 | -- To unsubscribe from this list: send the line "unsubscribe linux-serial"= in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 From: s.trumtrar@pengutronix.de (Steffen Trumtrar) Date: Thu, 13 Dec 2012 09:40:17 +0100 Subject: [PATCH] mxs: uart: allow setting RTS from software In-Reply-To: <50C93B6B.7090206@freescale.com> References: <1355329913-27666-1-git-send-email-s.trumtrar@pengutronix.de> <50C93B6B.7090206@freescale.com> Message-ID: <20121213084017.GA27832@pengutronix.de> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi, On Thu, Dec 13, 2012 at 10:20:27AM +0800, Huang Shijie wrote: > ? 2012?12?13? 00:31, Steffen Trumtrar ??: > > With the patch "serial: mxs-auart: fix the wrong RTS hardware flow control" the > > mainline mxs-uart driver now sets RTSEN only when hardware flow control is > > enabled via software. It is not possible any longer to set RTS manually via > > software. However, the manual modification is a valid operation. > > Regain the possibility to set RTS via software and only set RTSEN when hardware > Is there any user case to set the RTS via software? > I am confused at this. there are cases where the RTS is used in a non-standard way. And the always-on hardware flowcontrol breaks these (e.g. Echelon FT5000). And as stated in the commit message, it is a valid operation to use software flow control. > > flow control is explicitly enabled via settermios cflag CRTSCTS. > > > > Signed-off-by: Steffen Trumtrar > > --- > > drivers/tty/serial/mxs-auart.c | 8 +++++++- > > 1 file changed, 7 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c > > index 6db23b0..9b62c4b 100644 > > --- a/drivers/tty/serial/mxs-auart.c > > +++ b/drivers/tty/serial/mxs-auart.c > > @@ -412,10 +412,12 @@ static void mxs_auart_set_mctrl(struct uart_port *u, unsigned mctrl) > > > > u32 ctrl = readl(u->membase + AUART_CTRL2); > > > > - ctrl &= ~AUART_CTRL2_RTSEN; > > + ctrl &= ~(AUART_CTRL2_RTSEN | AUART_CTRL2_RTS); > > if (mctrl & TIOCM_RTS) { > > if (tty_port_cts_enabled(&u->state->port)) > > ctrl |= AUART_CTRL2_RTSEN; > > + else > > + ctrl |= AUART_CTRL2_RTS; > > } > > > > s->ctrl = mctrl; > > @@ -678,6 +680,10 @@ static void mxs_auart_settermios(struct uart_port *u, > > } > > ctrl2 |= AUART_CTRL2_CTSEN | AUART_CTRL2_RTSEN; > > } else { > > + u->flags |= ASYNC_CTS_FLOW; > > + ctrl2 |= AUART_CTRL2_CTSEN | AUART_CTRL2_RTSEN; > > + } else { > > + u->flags &= ~ASYNC_CTS_FLOW; > bug. > > Your code adds TWO "else" here. > Oops, wrong merge resolution. Will fix that. Regards, Steffen -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |