Skip to contentSkip to conversation

Cleanup patch for RS485 on Cris architecture

PATCH In review Claudio Scordino 3 participants 5 messages Feb 25, 2009 – May 31, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Cleanup patch for RS485 on Cris architecture

Dear Alan, dear Andrew,

around one month ago I submitted a cleanup patch to use the new
general RS485 Linux data structure (introduced by Alan with commit number c26c56c0f40e200e61d1390629c806f6adaffbcc) in the Cris architecture too (currently, Cris still uses the old private data structure instead of the new one).

The code compiled, but I couldn't test it at that time.

Now, the code has been tested by Hinko Kocevar and Janez Cufer (CC:-ed) from the AXIS group, who also fixed a bug.

Therefore, can you please commit the patch in attachment ?

Many thanks,

Claudio Scordino

Quoted 1 line

From 9d4397feff9773820e158693aa73621c0c20f017 Mon Sep 17 00:00:00 2001

From: Claudio Scordino <[email protected]>
Date: Tue, 24 Feb 2009 18:00:44 +0100
Subject: [PATCH 1/1] RS485 support on Cris rewritten in order to use new serial_rs485 data structure

---
 arch/cris/include/asm/ioctls.h  |    5 +-
 arch/cris/include/asm/rs485.h   |    8 +--
 arch/cris/include/asm/termios.h |    1 +
 drivers/serial/crisv10.c        |   80 ++++++++++++++++++++++++++++-----------
 drivers/serial/crisv10.h        |    2 +-
 5 files changed, 66 insertions(+), 30 deletions(-)
arch/cris/include/asm/ioctls.h +3 -2
index 4f4e525..35bbc18 100644
@@ -74,8 +74,9 @@
 #define TIOCSHAYESESP   0x545F  /* Set Hayes ESP configuration */
 #define FIOQSIZE	0x5460
 
-#define TIOCSERSETRS485 0x5461  /* enable rs-485 */
-#define TIOCSERWRRS485  0x5462  /* write rs-485 */
+#define TIOCSERSETRS485	0x5461  /* enable rs-485 (deprecated) */
+#define TIOCSERWRRS485	0x5462  /* write rs-485 */
+#define TIOCSRS485	0x5463  /* enable rs-485 */
 
 /* Used for packet mode */
 #define TIOCPKT_DATA		 0
arch/cris/include/asm/rs485.h +3 -5
index c331c51..ad40f9f 100644
@@ -1,15 +1,13 @@
 /* RS-485 structures */
 
-/* RS-485 support */
-/* Used with ioctl() TIOCSERSETRS485 */
+/* Used with ioctl() TIOCSERSETRS485 for backward compatibility!
+ * XXX: Do not use it for new code!
+ */
 struct rs485_control {
         unsigned short rts_on_send;
         unsigned short rts_after_sent;
         unsigned long delay_rts_before_send;
         unsigned short enabled;
-#ifdef __KERNEL__
-        int disable_serial_loopback;
-#endif
 };
 
 /* Used with ioctl() TIOCSERWRRS485 */
arch/cris/include/asm/termios.h +1 -0
index b0124e6..1265109 100644
@@ -4,6 +4,7 @@
 #include <asm/termbits.h>
 #include <asm/ioctls.h>
 #include <asm/rs485.h>
+#include <linux/serial.h>
 
 struct winsize {
 	unsigned short ws_row;
drivers/serial/crisv10.c +58 -22

183 lines not on this page · raw message

drivers/serial/crisv10.h +1 -1
index f36a729..ea0beb4 100644
@@ -125,7 +125,7 @@ struct e100_serial {
 	int errorcode;
 
 #ifdef CONFIG_ETRAX_RS485
-	struct rs485_control	rs485;  /* RS-485 support */
+	struct serial_rs485	rs485;  /* RS-485 support */
 #endif
 };
 
Signature · 1 line
1.5.4.3
#1 lore raw
Quoted 22 lines · On Wed, 25 Feb 2009 11:07:52 +0100 Claudio Scordino <[email protected]>…

Dear Alan, dear Andrew,

around one month ago I submitted a cleanup patch to use the new
general RS485 Linux data structure (introduced by Alan with commit number c26c56c0f40e200e61d1390629c806f6adaffbcc) in the Cris architecture too (currently, Cris still uses the old private data structure instead of the new one).

The code compiled, but I couldn't test it at that time.

Now, the code has been tested by Hinko Kocevar and Janez Cufer (CC:-ed) from the AXIS group, who also fixed a bug.

Therefore, can you please commit the patch in attachment ?

Many thanks,

Claudio Scordino

[0001-RS485-support-on-Cris-rewritten-in-order-to-use-new.patch text/x-diff (9.9KB)]

Quoted 1 line

From 9d4397feff9773820e158693aa73621c0c20f017 Mon Sep 17 00:00:00 2001

Quoted 8 lines

From: Claudio Scordino <[email protected]>
Date: Tue, 24 Feb 2009 18:00:44 +0100
Subject: [PATCH 1/1] RS485 support on Cris rewritten in order to use new serial_rs485 data structure

The patch had no changelog - please always provide one.

I scraped some text from your covering comment and made this:

Use the new general RS485 Linux data structure (introduced by Alan with commit number c26c56c0f40e200e61d1390629c806f6adaffbcc) in the Cris architecture too (currently, Cris still uses the old private data structure instead of the new one).

for a changelog. Feel free to send better text if that is inappropriate or incomplete.

#2 lore raw

Andrew Morton ha scritto:

Quoted 26 lines
Quoted 23 lines · On Wed, 25 Feb 2009 11:07:52 +0100 Claudio Scordino <[email protected]>…

Dear Alan, dear Andrew,

around one month ago I submitted a cleanup patch to use the new
general RS485 Linux data structure (introduced by Alan with commit number c26c56c0f40e200e61d1390629c806f6adaffbcc) in the Cris architecture too (currently, Cris still uses the old private data structure instead of the new one).

The code compiled, but I couldn't test it at that time.

Now, the code has been tested by Hinko Kocevar and Janez Cufer (CC:-ed) from the AXIS group, who also fixed a bug.

Therefore, can you please commit the patch in attachment ?

Many thanks,

Claudio Scordino

[0001-RS485-support-on-Cris-rewritten-in-order-to-use-new.patch text/x-diff (9.9KB)]

Quoted 1 line

From 9d4397feff9773820e158693aa73621c0c20f017 Mon Sep 17 00:00:00 2001

From: Claudio Scordino <[email protected]>
Date: Tue, 24 Feb 2009 18:00:44 +0100
Subject: [PATCH 1/1] RS485 support on Cris rewritten in order to use new serial_rs485 data structure

Quoted 5 lines
Quoted 3 lines

The patch had no changelog - please always provide one.

Sorry, my apologies... Next time I'll keep in mind!

Quoted 10 lines

I scraped some text from your covering comment and made this:

Use the new general RS485 Linux data structure (introduced by Alan with commit number c26c56c0f40e200e61d1390629c806f6adaffbcc) in the Cris architecture too (currently, Cris still uses the old private data structure instead of the new one).

for a changelog. Feel free to send better text if that is inappropriate or incomplete.

This changelog is perfect.

Many thanks,

Claudio

#3 lore raw

PATCH 1/1 ioctl for getting RS485 information on Cris architecture

In reply to Claudio Scordino

Hi Jesper, hi Mikael,

I think that the Cris architecture should provide a full RS485 interface (like the atmel_serial driver).

Therefore, I propose this patch which adds an ioctl to get RS485 information from user-level.

Best regards,

Claudio

Cris serial driver: ioctl to get RS485 data from user-space

---
 arch/cris/include/asm/ioctls.h |    1 +
 drivers/serial/crisv10.c       |   11 +++++++++++
 2 files changed, 12 insertions(+), 0 deletions(-)
arch/cris/include/asm/ioctls.h +1 -0
index 35bbc18..076c078 100644
@@ -77,6 +77,7 @@
 #define TIOCSERSETRS485	0x5461  /* enable rs-485 (deprecated) */
 #define TIOCSERWRRS485	0x5462  /* write rs-485 */
 #define TIOCSRS485	0x5463  /* enable rs-485 */
+#define TIOCGRS485	0x542E  /* get rs-485 */
 
 /* Used for packet mode */
 #define TIOCPKT_DATA		 0
drivers/serial/crisv10.c +11 -0
index 31f1723..3062644 100644
@@ -3724,6 +3724,17 @@ rs_ioctl(struct tty_struct *tty, struct file * file,
 		return e100_enable_rs485(tty, &rs485data);
 	}
 
+	case TIOCGRS485:
+	{
+		struct serial_rs485 *rs485data =
+			&(((struct e100_serial *)tty->driver_data)->rs485);
+		/* This is the ioctl to get RS485 data from user-space */
+		if (copy_to_user((struct serial_rs485 *) arg,
+					rs485data,
+					sizeof(serial_rs485)))
+			return -EFAULT;
+		break;
+	}
 
 	case TIOCSERWRRS485:
 	{
Signature · 1 line
1.6.0.4
#4 lore raw

Re: [PATCH] ioctl for getting RS485 information on Cris architecture

Quoted 5 lines · Claudio Scordino

Hi Jesper, hi Mikael,

I think that the Cris architecture should provide a full RS485 interface (like the atmel_serial driver).

Therefore, I propose this patch which adds an ioctl to get RS485 information from user-level.

Thanks, looks good, I'll take this into the CRIS tree.

Quoted 1 line

Claudio

/^JN - Jesper Nilsson

Signature · 1 line
               Jesper Nilsson -- [email protected]