All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
To: Huang Shijie <b32955@freescale.com>
Cc: linux-serial@vger.kernel.org, stable@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Alan Cox <alan@linux.intel.com>
Subject: Re: [PATCH] mxs: uart: allow setting RTS from software
Date: Thu, 13 Dec 2012 09:40:17 +0100	[thread overview]
Message-ID: <20121213084017.GA27832@pengutronix.de> (raw)
In-Reply-To: <50C93B6B.7090206@freescale.com>

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 <s.trumtrar@pengutronix.de>
> > ---
> >  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 |
--
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

WARNING: multiple messages have this Message-ID (diff)
From: s.trumtrar@pengutronix.de (Steffen Trumtrar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] mxs: uart: allow setting RTS from software
Date: Thu, 13 Dec 2012 09:40:17 +0100	[thread overview]
Message-ID: <20121213084017.GA27832@pengutronix.de> (raw)
In-Reply-To: <50C93B6B.7090206@freescale.com>

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 <s.trumtrar@pengutronix.de>
> > ---
> >  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 |

  reply	other threads:[~2012-12-13  8:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-12 16:31 [PATCH] mxs: uart: allow setting RTS from software Steffen Trumtrar
2012-12-12 16:31 ` Steffen Trumtrar
2012-12-13  2:20 ` Huang Shijie
2012-12-13  2:20   ` Huang Shijie
2012-12-13  8:40   ` Steffen Trumtrar [this message]
2012-12-13  8:40     ` Steffen Trumtrar
2012-12-14 14:11 ` Ben Hutchings
2012-12-14 14:11   ` Ben Hutchings

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=20121213084017.GA27832@pengutronix.de \
    --to=s.trumtrar@pengutronix.de \
    --cc=alan@linux.intel.com \
    --cc=b32955@freescale.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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.