linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] CRIS RS485: Check SER_RS485_RTS_BEFORE_SEND before delaying.
@ 2010-08-11 15:09 Claudio Scordino
  2010-08-30  8:32 ` Claudio Scordino
  0 siblings, 1 reply; 4+ messages in thread
From: Claudio Scordino @ 2010-08-11 15:09 UTC (permalink / raw)
  To: Jesper Nilsson
  Cc: starvik, linux-cris-kernel, Alan Cox, Andrew Morton,
	Hinko Kocevar, Janez Cufer, Andy Whitcroft, Linux Kernel,
	dev-etrax, linux-serial

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] CRIS RS485: Check SER_RS485_RTS_BEFORE_SEND before delaying.
  2010-08-11 15:09 [PATCH] CRIS RS485: Check SER_RS485_RTS_BEFORE_SEND before delaying Claudio Scordino
@ 2010-08-30  8:32 ` Claudio Scordino
  2010-08-30  8:39   ` Mikael Starvik
  0 siblings, 1 reply; 4+ messages in thread
From: Claudio Scordino @ 2010-08-30  8:32 UTC (permalink / raw)
  To: Jesper Nilsson
  Cc: starvik, linux-cris-kernel, Alan Cox, Andrew Morton,
	Hinko Kocevar, Janez Cufer, Andy Whitcroft, Linux Kernel,
	dev-etrax, linux-serial

Claudio Scordino ha scritto:
> 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.


Hi all,

	so far I didn't receive any acknowledgement about this patch.

As I said, recently (see commit 1b6331848b69d1ed165a6bdc75c4046d68767563) the
Linux RS485 interface has been fixed by adding two missing fields.

With the "new" interface, you have to check the SER_RS485_RTS_BEFORE_SEND flag
before using the delay_rts_before_send field.

The Atmel serial driver has been already fixed (with commit
1b6331848b69d1ed165a6bdc75c4046d68767563 itself).

This patch fixes the usage of the interface in the Cris driver too.

Best regards,

		Claudio

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] CRIS RS485: Check SER_RS485_RTS_BEFORE_SEND before delaying.
  2010-08-30  8:32 ` Claudio Scordino
@ 2010-08-30  8:39   ` Mikael Starvik
  2010-10-19 12:34     ` Claudio Scordino
  0 siblings, 1 reply; 4+ messages in thread
From: Mikael Starvik @ 2010-08-30  8:39 UTC (permalink / raw)
  To: Claudio Scordino, Jesper Nilsson
  Cc: linux-cris-kernel, Alan Cox, Andrew Morton, Hinko Kocevar,
	Janez Cufer, Andy Whitcroft, Linux Kernel, dev-etrax,
	linux-serial@vger.kernel.org

Hi!

Jesper is on vacation but I find this patch ok.

Acked-by: Mikael Starvik<Starvik@axis.com>

/Mikael

-----Original Message-----
From: Claudio Scordino [mailto:claudio@evidence.eu.com] 
Sent: den 30 augusti 2010 10:32
To: Jesper Nilsson
Cc: Mikael Starvik; linux-cris-kernel; Alan Cox; Andrew Morton; Hinko Kocevar; Janez Cufer; Andy Whitcroft; Linux Kernel; dev-etrax; linux-serial@vger.kernel.org
Subject: Re: [PATCH] CRIS RS485: Check SER_RS485_RTS_BEFORE_SEND before delaying.

Claudio Scordino ha scritto:
> 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.


Hi all,

	so far I didn't receive any acknowledgement about this patch.

As I said, recently (see commit 1b6331848b69d1ed165a6bdc75c4046d68767563) the
Linux RS485 interface has been fixed by adding two missing fields.

With the "new" interface, you have to check the SER_RS485_RTS_BEFORE_SEND flag
before using the delay_rts_before_send field.

The Atmel serial driver has been already fixed (with commit
1b6331848b69d1ed165a6bdc75c4046d68767563 itself).

This patch fixes the usage of the interface in the Cris driver too.

Best regards,

		Claudio

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] CRIS RS485: Check SER_RS485_RTS_BEFORE_SEND before delaying.
  2010-08-30  8:39   ` Mikael Starvik
@ 2010-10-19 12:34     ` Claudio Scordino
  0 siblings, 0 replies; 4+ messages in thread
From: Claudio Scordino @ 2010-10-19 12:34 UTC (permalink / raw)
  To: Mikael Starvik, Jesper Nilsson
  Cc: linux-cris-kernel, Alan Cox, Andrew Morton, Hinko Kocevar,
	Janez Cufer, Andy Whitcroft, Linux Kernel, dev-etrax,
	linux-serial@vger.kernel.org

Mikael Starvik ha scritto:
> Hi!
> 
> Jesper is on vacation but I find this patch ok.
> 
> Acked-by: Mikael Starvik<Starvik@axis.com>

Hi Mikael, Hi Jesper,

	the merge window will be opened very soon. So, please remember
this patch.

I already fixed the atmel_serial driver (commit number
1b6331848b69d1ed165a6bdc75c4046d68767563)
	
Now, it's quite important to fix the Cris driver as well.

Cheers,

       Claudio


CRIS RS485: Check SER_RS485_RTS_BEFORE_SEND before delaying.

Signed-off-by: Claudio Scordino <claudio@evidence.eu.com>
Acked-by: Mikael Starvik <Starvik@axis.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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-10-19 12:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-11 15:09 [PATCH] CRIS RS485: Check SER_RS485_RTS_BEFORE_SEND before delaying Claudio Scordino
2010-08-30  8:32 ` Claudio Scordino
2010-08-30  8:39   ` Mikael Starvik
2010-10-19 12:34     ` Claudio Scordino

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).