From: Claudio Scordino <claudio@evidence.eu.com>
To: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: starvik@axis.com, linux-cris-kernel <linux-cris-kernel@axis.com>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
Andrew Morton <akpm@linux-foundation.org>,
Hinko Kocevar <hinko.kocevar@cetrtapot.si>,
Janez Cufer <janez.cufer@cetrtapot.si>,
Andy Whitcroft <apw@canonical.com>,
Linux Kernel <linux-kernel@vger.kernel.org>,
dev-etrax <dev-etrax@axis.com>,
linux-serial@vger.kernel.org
Subject: [PATCH] CRIS RS485: Check SER_RS485_RTS_BEFORE_SEND before delaying.
Date: Wed, 11 Aug 2010 17:09:31 +0200 [thread overview]
Message-ID: <4C62BD2B.2010508@evidence.eu.com> (raw)
Hi Jesper,
the following patch fixes the usage of the delay in RS485 mode
on the Cris architecture.
Very recently, the RS485 interface has been fixed by adding two further
fields (see commit 1b6331848b69d1ed165a6bdc75c4046d68767563).
This patch checks the value of the flag SER_RS485_RTS_BEFORE_SEND before
delaying.
Best regards,
Claudio
CRIS RS485: Check SER_RS485_RTS_BEFORE_SEND before delaying.
Signed-off-by: Claudio Scordino <claudio@evidence.eu.com>
---
drivers/serial/crisv10.c | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c
index c856905..a2237e7 100644
--- a/drivers/serial/crisv10.c
+++ b/drivers/serial/crisv10.c
@@ -1411,11 +1411,12 @@ e100_enable_rs485(struct tty_struct *tty, struct serial_rs485 *r)
CONFIG_ETRAX_RS485_LTC1387_RXEN_PORT_G_BIT, 1);
#endif
- info->rs485.flags = r->flags;
- if (r->delay_rts_before_send >= 1000)
+ info->rs485 = *r;
+
+ /* Maximum delay before RTS equal to 1000 */
+ if (info->rs485.delay_rts_before_send >= 1000)
info->rs485.delay_rts_before_send = 1000;
- else
- info->rs485.delay_rts_before_send = r->delay_rts_before_send;
+
/* printk("rts: on send = %i, after = %i, enabled = %i",
info->rs485.rts_on_send,
info->rs485.rts_after_sent,
@@ -3234,9 +3235,9 @@ rs_write(struct tty_struct *tty,
e100_disable_rx(info);
e100_enable_rx_irq(info);
#endif
-
- if (info->rs485.delay_rts_before_send > 0)
- msleep(info->rs485.delay_rts_before_send);
+ if ((info->rs485.flags & SER_RS485_RTS_BEFORE_SEND) &&
+ (info->rs485.delay_rts_before_send > 0))
+ msleep(info->rs485.delay_rts_before_send);
}
#endif /* CONFIG_ETRAX_RS485 */
@@ -3694,6 +3695,11 @@ rs_ioctl(struct tty_struct *tty, struct file * file,
rs485data.delay_rts_before_send = rs485ctrl.delay_rts_before_send;
rs485data.flags = 0;
+ if (rs485data.delay_rts_before_send != 0)
+ rs485data.flags |= SER_RS485_RTS_BEFORE_SEND;
+ else
+ rs485data.flags &= ~(SER_RS485_RTS_BEFORE_SEND);
+
if (rs485ctrl.enabled)
rs485data.flags |= SER_RS485_ENABLED;
else
@@ -4527,6 +4533,7 @@ static int __init rs_init(void)
/* Set sane defaults */
info->rs485.flags &= ~(SER_RS485_RTS_ON_SEND);
info->rs485.flags |= SER_RS485_RTS_AFTER_SEND;
+ info->rs485.flags &= ~(SER_RS485_RTS_BEFORE_SEND);
info->rs485.delay_rts_before_send = 0;
info->rs485.flags &= ~(SER_RS485_ENABLED);
#endif
--
1.6.0.4
next reply other threads:[~2010-08-11 15:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-11 15:09 Claudio Scordino [this message]
2010-08-30 8:32 ` [PATCH] CRIS RS485: Check SER_RS485_RTS_BEFORE_SEND before delaying Claudio Scordino
2010-08-30 8:39 ` Mikael Starvik
2010-10-19 12:34 ` Claudio Scordino
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=4C62BD2B.2010508@evidence.eu.com \
--to=claudio@evidence.eu.com \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=apw@canonical.com \
--cc=dev-etrax@axis.com \
--cc=hinko.kocevar@cetrtapot.si \
--cc=janez.cufer@cetrtapot.si \
--cc=jesper.nilsson@axis.com \
--cc=linux-cris-kernel@axis.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=starvik@axis.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).