Re: [PATCH] Documentation about RS485 serial communications

Previous thread: linux-next: build failure after merge of the slabh tree by Stephen Rothwell on Sunday, March 28, 2010 - 11:55 pm. (2 messages)

Next thread: [PATCH] x86, MCE, fix MSR_IA32_MCI_CTL2 CMCI threshold setup by Huang Ying on Monday, March 29, 2010 - 12:16 am. (4 messages)
From: Claudio Scordino
Date: Monday, March 29, 2010 - 12:16 am

Hi all,

   this is the new version of the patch to add RS485 support to the
   atmel_serial driver. It's been changed according to Ryan Mallon's
   comments.

This new patch has been tested again (with and without DMA) by Sebastian
Heutling (CC:-ed).

Many thanks to all,

           Claudio


atmel_serial: Atmel RS485 support

Signed-off-by: Claudio Scordino <claudio@evidence.eu.com>
Signed-off-by: Michael Trimarchi <michael@evidence.eu.com>
Signed-off-by: Rick Bronson <rick@efn.org>
Signed-off-by: Sebastian Heutling <Sebastian.Heutling@who-ing.de>
---
 arch/arm/include/asm/ioctls.h           |    2 +
 arch/arm/mach-at91/include/mach/board.h |    2 +
 drivers/serial/atmel_serial.c           |  244 ++++++++++++++++++++++++++-----
 3 files changed, 212 insertions(+), 36 deletions(-)

diff --git a/arch/arm/include/asm/ioctls.h b/arch/arm/include/asm/ioctls.h
index a91d8a1..82f2177 100644
--- a/arch/arm/include/asm/ioctls.h
+++ b/arch/arm/include/asm/ioctls.h
@@ -70,6 +70,8 @@
 #define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
 #define FIOQSIZE	0x545E
 
+#define TIOCSRS485	0x5461
+
 /* Used for packet mode */
 #define TIOCPKT_DATA		 0
 #define TIOCPKT_FLUSHREAD	 1
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
index ceaec6c..fd8a385 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -39,6 +39,7 @@
 #include <linux/usb/atmel_usba_udc.h>
 #include <linux/atmel-mci.h>
 #include <sound/atmel-ac97c.h>
+#include <linux/serial.h>
 
  /* USB Device */
 struct at91_udc_data {
@@ -146,6 +147,7 @@ struct atmel_uart_data {
 	short		use_dma_tx;	/* use transmit DMA? */
 	short		use_dma_rx;	/* use receive DMA? */
 	void __iomem	*regs;		/* virtual base address, if any */
+	struct serial_rs485	rs485;	/* rs485 settings */
 };
 extern void __init at91_add_device_serial(void);
 
diff --git a/drivers/serial/atmel_serial.c ...
From: Ryan Mallon
Date: Monday, March 29, 2010 - 12:44 pm

Can you re-indent this structure so the rest of the members line up with





"Setting" UART to RS485 probably makes more sense here (and couple of

You could remove this dev_dbg since amtel_config_rs485 already prints

~Ryan

-- 
Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
ryan@bluewatersys.com         	PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com	New Zealand
Phone: +64 3 3779127		Freecall: Australia 1800 148 751
Fax:   +64 3 3779135			  USA 1800 261 2934
--

From: Claudio Scordino
Date: Tuesday, March 30, 2010 - 2:07 am

Hi Ryan,

   many thanks for your feedback.

Please find attached a new version of the patch, modified according to
your comments.

Regards,

         Claudio


atmel_serial: Atmel RS485 support

Signed-off-by: Claudio Scordino <claudio@evidence.eu.com>
Signed-off-by: Michael Trimarchi <michael@evidence.eu.com>
Signed-off-by: Rick Bronson <rick@efn.org>
Signed-off-by: Sebastian Heutling <Sebastian.Heutling@who-ing.de>
---
 arch/arm/include/asm/ioctls.h           |    2 +
 arch/arm/mach-at91/include/mach/board.h |    8 +-
 drivers/serial/atmel_serial.c           |  241 ++++++++++++++++++++++++++-----
 3 files changed, 212 insertions(+), 39 deletions(-)

diff --git a/arch/arm/include/asm/ioctls.h b/arch/arm/include/asm/ioctls.h
index a91d8a1..82f2177 100644
--- a/arch/arm/include/asm/ioctls.h
+++ b/arch/arm/include/asm/ioctls.h
@@ -70,6 +70,8 @@
 #define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
 #define FIOQSIZE	0x545E
 
+#define TIOCSRS485	0x5461
+
 /* Used for packet mode */
 #define TIOCPKT_DATA		 0
 #define TIOCPKT_FLUSHREAD	 1
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
index ceaec6c..df2ed84 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -39,6 +39,7 @@
 #include <linux/usb/atmel_usba_udc.h>
 #include <linux/atmel-mci.h>
 #include <sound/atmel-ac97c.h>
+#include <linux/serial.h>
 
  /* USB Device */
 struct at91_udc_data {
@@ -143,9 +144,10 @@ extern struct platform_device *atmel_default_console_device;
 extern void __init __deprecated at91_init_serial(struct at91_uart_config *config);
 
 struct atmel_uart_data {
-	short		use_dma_tx;	/* use transmit DMA? */
-	short		use_dma_rx;	/* use receive DMA? */
-	void __iomem	*regs;		/* virtual base address, if any */
+	short			use_dma_tx;	/* use transmit DMA? */
+	short			use_dma_rx;	/* use receive DMA? */
+	void __iomem		*regs;		/* virt. base address, if any */
+	struct ...
From: Ryan Mallon
Date: Tuesday, March 30, 2010 - 12:37 pm

Looks good. You should add a Tested-by for Sebastian, and you can add:

Reviewed-by: Ryan Mallon <ryan@bluewatersys.com>



-- 
Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
ryan@bluewatersys.com         	PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com	New Zealand
Phone: +64 3 3779127		Freecall: Australia 1800 148 751
Fax:   +64 3 3779135			  USA 1800 261 2934
--

From: Claudio Scordino
Date: Thursday, April 8, 2010 - 12:58 am

Here it is (I just added the Tested-by and Reviewed-by fields).

Best regards,

            Claudio


atmel_serial: Atmel RS485 support

Signed-off-by: Claudio Scordino <claudio@evidence.eu.com>
Signed-off-by: Michael Trimarchi <michael@evidence.eu.com>
Signed-off-by: Rick Bronson <rick@efn.org>
Signed-off-by: Sebastian Heutling <Sebastian.Heutling@who-ing.de>
Tested-by: Sebastian Heutling <Sebastian.Heutling@who-ing.de>
Reviewed-by: Ryan Mallon <ryan@bluewatersys.com>
---
 arch/arm/include/asm/ioctls.h           |    2 +
 arch/arm/mach-at91/include/mach/board.h |    8 +-
 drivers/serial/atmel_serial.c           |  241 ++++++++++++++++++++++++++-----
 3 files changed, 212 insertions(+), 39 deletions(-)

diff --git a/arch/arm/include/asm/ioctls.h b/arch/arm/include/asm/ioctls.h
index a91d8a1..82f2177 100644
--- a/arch/arm/include/asm/ioctls.h
+++ b/arch/arm/include/asm/ioctls.h
@@ -70,6 +70,8 @@
 #define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
 #define FIOQSIZE	0x545E
 
+#define TIOCSRS485	0x5461
+
 /* Used for packet mode */
 #define TIOCPKT_DATA		 0
 #define TIOCPKT_FLUSHREAD	 1
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
index ceaec6c..df2ed84 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -39,6 +39,7 @@
 #include <linux/usb/atmel_usba_udc.h>
 #include <linux/atmel-mci.h>
 #include <sound/atmel-ac97c.h>
+#include <linux/serial.h>
 
  /* USB Device */
 struct at91_udc_data {
@@ -143,9 +144,10 @@ extern struct platform_device *atmel_default_console_device;
 extern void __init __deprecated at91_init_serial(struct at91_uart_config *config);
 
 struct atmel_uart_data {
-	short		use_dma_tx;	/* use transmit DMA? */
-	short		use_dma_rx;	/* use receive DMA? */
-	void __iomem	*regs;		/* virtual base address, if any */
+	short			use_dma_tx;	/* use transmit DMA? */
+	short			use_dma_rx;	/* use receive DMA? */
+	void ...
From: Russell King - ARM Linux
Date: Thursday, April 8, 2010 - 2:01 am

Why are you only supporting half the interface?

#define TIOCGRS485      0x542E
#define TIOCSRS485      0x542F

is what is in include/asm-generic/ioctls.h - and it would be a good idea
to use the same numbering as the generic file rather than creating yet
more divergence.
--

From: Alan Cox
Date: Thursday, April 8, 2010 - 3:13 am

NAK - assorted problems, notably locking ones caused by the sysfs stuff



Expain the locking on this could you - I don't see what protects against




Ditto


Given the locking mess you are going to create I would suggest dropping
the sysfs stuff.

Alan
--

From: Claudio Scordino
Date: Thursday, April 8, 2010 - 6:16 am

Thank you for the feedback.

Let me know if this new version solves the above problems.

	Claudio


atmel_serial: Atmel RS485 support

Signed-off-by: Claudio Scordino <claudio@evidence.eu.com>
Signed-off-by: Michael Trimarchi <michael@evidence.eu.com>
Signed-off-by: Rick Bronson <rick@efn.org>
Signed-off-by: Sebastian Heutling <Sebastian.Heutling@who-ing.de>
Tested-by: Sebastian Heutling <Sebastian.Heutling@who-ing.de>
Reviewed-by: Ryan Mallon <ryan@bluewatersys.com>
---
 arch/arm/include/asm/ioctls.h           |    3 +
 arch/arm/mach-at91/include/mach/board.h |    8 +-
 drivers/serial/atmel_serial.c           |  203 +++++++++++++++++++++++++------
 3 files changed, 176 insertions(+), 38 deletions(-)

diff --git a/arch/arm/include/asm/ioctls.h b/arch/arm/include/asm/ioctls.h
index a91d8a1..7f0b6d1 100644
--- a/arch/arm/include/asm/ioctls.h
+++ b/arch/arm/include/asm/ioctls.h
@@ -53,6 +53,9 @@
 #define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
 #define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
 
+#define TIOCGRS485      0x542E
+#define TIOCSRS485      0x542F
+
 #define FIONCLEX	0x5450  /* these numbers need to be adjusted. */
 #define FIOCLEX		0x5451
 #define FIOASYNC	0x5452
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
index ceaec6c..df2ed84 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -39,6 +39,7 @@
 #include <linux/usb/atmel_usba_udc.h>
 #include <linux/atmel-mci.h>
 #include <sound/atmel-ac97c.h>
+#include <linux/serial.h>
 
  /* USB Device */
 struct at91_udc_data {
@@ -143,9 +144,10 @@ extern struct platform_device *atmel_default_console_device;
 extern void __init __deprecated at91_init_serial(struct at91_uart_config *config);
 
 struct atmel_uart_data {
-	short		use_dma_tx;	/* use transmit DMA? */
-	short		use_dma_rx;	/* use receive DMA? */
-	void __iomem	*regs;		/* virtual base address, if any ...
From: Alan Cox
Date: Thursday, April 8, 2010 - 6:42 am

Looks good to me. Thanks for the quick clean up.

Alan
--

From: Nicolas Ferre
Date: Wednesday, May 26, 2010 - 6:18 am

Le 08/04/2010 15:16, Claudio Scordino :


Even though I personally did not test this patch I think it is time to
go forward with this very good work.

Considering the number of people involved in this testing and review I
think that we can submit this patch for mainline. Who will handle it?
- do we submit to ARM or serial subsystem ?

Best regards,
-- 
Nicolas Ferre

--

From: Claudio Scordino
Date: Thursday, May 27, 2010 - 1:37 am

Hi Nicolas,

    the latest version of the patch has been already merged in the
latest Linus' git tree through Russell King's patchsystem (the maintainer of the
driver never answered to emails...).

Many thanks,

       Claudio



--

From: Nicolas Ferre
Date: Thursday, May 27, 2010 - 2:57 am

My fault: I use to check Russell patchsystem with "AT91" searching

I was supposed to take over its maintainance one year ago but did not
find time to do it. My fault here also...

Anyway, it was the occasion to tell all of you that this RS485 support
is a nice job and that even if I do not answer, I try to track all
interesting activity in the background.

Best regards,
-- 
Nicolas Ferre

--

From: Wolfram Sang
Date: Thursday, May 27, 2010 - 3:29 am

Hi Claudio,


Nitpick: Wasn't there some documentation promised after the final patch ;)

Regards,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
From: Claudio Scordino
Date: Friday, May 28, 2010 - 8:05 am

Many thanks!


Here is the first attempt.

Best regards,

		Claudio


Documentation about RS485

Signed-off-by: Claudio Scordino <claudio@evidence.eu.com>
---
 Documentation/serial/00-INDEX         |    2 +
 Documentation/serial/serial-rs485.txt |  118 +++++++++++++++++++++++++++++++++
 2 files changed, 120 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/serial/serial-rs485.txt

diff --git a/Documentation/serial/00-INDEX b/Documentation/serial/00-INDEX
index 07dcdb0..e09468a 100644
--- a/Documentation/serial/00-INDEX
+++ b/Documentation/serial/00-INDEX
@@ -14,6 +14,8 @@ riscom8.txt
 	- notes on using the RISCom/8 multi-port serial driver.
 rocket.txt
 	- info on the Comtrol RocketPort multiport serial driver.
+serial-rs485.txt
+	- info about RS485 structures and support in the kernel.
 specialix.txt
 	- info on hardware/driver for specialix IO8+ multiport serial card.
 stallion.txt
diff --git a/Documentation/serial/serial-rs485.txt b/Documentation/serial/serial-rs485.txt
new file mode 100644
index 0000000..dac98c3
--- /dev/null
+++ b/Documentation/serial/serial-rs485.txt
@@ -0,0 +1,118 @@
+                        RS485 SERIAL COMMUNICATIONS
+
+1. INTRODUCTION
+
+   EIA-485, also known as TIA/EIA-485 or RS-485, is a standard defining the
+   electrical characteristics of drivers and receivers for use in balanced
+   digital multipoint systems.
+   This standard is widely used for communications in industrial automation
+   because it can be used effectively over long distances and in electrically
+   noisy environments.
+   Even though the data is transmitted over a 2-wire twisted pair bus, all
+   EIA-485 transceivers interpret the voltage levels of the differential
+   signals with respect to a third common voltage. Without this common
+   reference, a set of transceivers may interpret the differential signals
+   incorrectly.
+   See [1] for more information.
+
+
+2. HARDWARE-RELATED CONSIDERATIONS
+
+   Some CPUs (e.g., Atmel AT91) ...
From: Claudio Scordino
Date: Wednesday, August 11, 2010 - 2:26 am

Hi all,

	some time ago I've been asked (by both Wolfram and Philippe) to
provide some minimal documentation about the usage of the RS485
interface.

Here is the document (updated with the very last changes in the
interface).

Best regards,

	Claudio


Documentation about RS485 serial communications.

Signed-off-by: Claudio Scordino <claudio@evidence.eu.com>
---
 Documentation/serial/00-INDEX         |    2 +
 Documentation/serial/serial-rs485.txt |  123 +++++++++++++++++++++++++++++++++
 2 files changed, 125 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/serial/serial-rs485.txt

diff --git a/Documentation/serial/00-INDEX b/Documentation/serial/00-INDEX
index 07dcdb0..e09468a 100644
--- a/Documentation/serial/00-INDEX
+++ b/Documentation/serial/00-INDEX
@@ -14,6 +14,8 @@ riscom8.txt
 	- notes on using the RISCom/8 multi-port serial driver.
 rocket.txt
 	- info on the Comtrol RocketPort multiport serial driver.
+serial-rs485.txt
+	- info about RS485 structures and support in the kernel.
 specialix.txt
 	- info on hardware/driver for specialix IO8+ multiport serial card.
 stallion.txt
diff --git a/Documentation/serial/serial-rs485.txt b/Documentation/serial/serial-rs485.txt
new file mode 100644
index 0000000..f594831
--- /dev/null
+++ b/Documentation/serial/serial-rs485.txt
@@ -0,0 +1,123 @@
+                        RS485 SERIAL COMMUNICATIONS
+
+1. INTRODUCTION
+
+   EIA-485, also known as TIA/EIA-485 or RS-485, is a standard defining the
+   electrical characteristics of drivers and receivers for use in balanced
+   digital multipoint systems.
+   This standard is widely used for communications in industrial automation
+   because it can be used effectively over long distances and in electrically
+   noisy environments.
+   Even though the data is transmitted over a 2-wire twisted pair bus, all
+   EIA-485 transceivers interpret the voltage levels of the differential
+   signals with respect to a third common voltage. Without this ...
From: Philippe De Muyter
Date: Wednesday, August 11, 2010 - 3:02 am

I surmise that all the real work, the read() and write() system calls,

-- 
Philippe De Muyter  phdm at macqel dot be  Tel +32 27029044
Macq Electronique SA  rue de l'Aeronef 2  B-1140 Bruxelles  Fax +32 27029077
--

From: Randy Dunlap
Date: Wednesday, August 11, 2010 - 8:32 am

should be able to work in both modes
or


TIOC[SG]RS485 are #defined in <asm-generic/ioctls.h>, so
#include <asm-generic/ioctls.h>




Thanks for the addition.

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
--

From: Claudio Scordino
Date: Wednesday, August 11, 2010 - 12:58 pm

Hi Randy,

	thank you for the feedback.


I noticed that for some architectures (e.g., cris) these ioctls are defined also in arch/cris/include/asm/ioctls.h, and with different values with respect to the values defined on asm-generic/ioctls.h.

Therefore, I wasn't completely sure that the values defined in asm-generic are being used in every driver...

Best regards,

	Claudio
--

From: Claudio Scordino
Date: Saturday, August 14, 2010 - 5:50 am

Hi all,

	here is the document about RS485 with the requested additions.

If OK, somebody please provide for merging.

Best regards,

	Claudio


Documentation about RS485 serial communications.

Signed-off-by: Claudio Scordino <claudio@evidence.eu.com>
---
 Documentation/serial/00-INDEX         |    2 +
 Documentation/serial/serial-rs485.txt |  126 +++++++++++++++++++++++++++++++++
 2 files changed, 128 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/serial/serial-rs485.txt

diff --git a/Documentation/serial/00-INDEX b/Documentation/serial/00-INDEX
index 07dcdb0..e09468a 100644
--- a/Documentation/serial/00-INDEX
+++ b/Documentation/serial/00-INDEX
@@ -14,6 +14,8 @@ riscom8.txt
 	- notes on using the RISCom/8 multi-port serial driver.
 rocket.txt
 	- info on the Comtrol RocketPort multiport serial driver.
+serial-rs485.txt
+	- info about RS485 structures and support in the kernel.
 specialix.txt
 	- info on hardware/driver for specialix IO8+ multiport serial card.
 stallion.txt
diff --git a/Documentation/serial/serial-rs485.txt b/Documentation/serial/serial-rs485.txt
new file mode 100644
index 0000000..93b029e
--- /dev/null
+++ b/Documentation/serial/serial-rs485.txt
@@ -0,0 +1,126 @@
+                        RS485 SERIAL COMMUNICATIONS
+
+1. INTRODUCTION
+
+   EIA-485, also known as TIA/EIA-485 or RS-485, is a standard defining the
+   electrical characteristics of drivers and receivers for use in balanced
+   digital multipoint systems.
+   This standard is widely used for communications in industrial automation
+   because it can be used effectively over long distances and in electrically
+   noisy environments.
+   Even though the data is transmitted over a 2-wire twisted pair bus, all
+   EIA-485 transceivers interpret the voltage levels of the differential
+   signals with respect to a third common voltage. Without this common
+   reference, a set of transceivers may interpret the differential signals
+   incorrectly.
+   See [1] ...
From: Randy Dunlap
Date: Sunday, August 15, 2010 - 3:02 pm

I would expect GregKH to merge it.

Acked-by: Randy Dunlap <randy.dunlap@oracle.com>



-- 
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
--

From: Russell King - ARM Linux
Date: Sunday, August 15, 2010 - 3:19 pm

There are devices on the market which are fully isolating RS485
transceivers which just take the A/B connections, measuring the
differential voltage, and provide you with the TXD/RXD TTL signals
for your UART.

Also note that [1] appears a little confused about the number of pins
required for RS485 - it says two, and then lists three pins.  I don't
think you can use this as being supportive of the requirement for three

Example code really should do things right, such as check for error
conditions - otherwise people will copy'n'paste this and assume that
--

From: Claudio Scordino
Date: Tuesday, October 19, 2010 - 5:28 am

Here is the new document containing the changed you've proposed.

If OK, somebody please provide for commit (the merge window is opening...).

Cheers,

	Claudio


Documentation about RS485 serial communications

Signed-off-by: Claudio Scordino <claudio@evidence.eu.com>
---
 Documentation/serial/00-INDEX         |    2 +
 Documentation/serial/serial-rs485.txt |  126 +++++++++++++++++++++++++++++++++
 2 files changed, 128 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/serial/serial-rs485.txt

diff --git a/Documentation/serial/00-INDEX b/Documentation/serial/00-INDEX
index 07dcdb0..e09468a 100644
--- a/Documentation/serial/00-INDEX
+++ b/Documentation/serial/00-INDEX
@@ -14,6 +14,8 @@ riscom8.txt
 	- notes on using the RISCom/8 multi-port serial driver.
 rocket.txt
 	- info on the Comtrol RocketPort multiport serial driver.
+serial-rs485.txt
+	- info about RS485 structures and support in the kernel.
 specialix.txt
 	- info on hardware/driver for specialix IO8+ multiport serial card.
 stallion.txt
diff --git a/Documentation/serial/serial-rs485.txt b/Documentation/serial/serial-rs485.txt
new file mode 100644
index 0000000..82ebc86
--- /dev/null
+++ b/Documentation/serial/serial-rs485.txt
@@ -0,0 +1,126 @@
+                        RS485 SERIAL COMMUNICATIONS
+
+1. INTRODUCTION
+
+   EIA-485, also known as TIA/EIA-485 or RS-485, is a standard defining the
+   electrical characteristics of drivers and receivers for use in balanced
+   digital multipoint systems.
+   This standard is widely used for communications in industrial automation
+   because it can be used effectively over long distances and in electrically
+   noisy environments.
+
+2. HARDWARE-RELATED CONSIDERATIONS
+
+   Some CPUs (e.g., Atmel AT91) contain a transceiver capable of working both
+   as RS232 and RS485. For these microcontrollers, the Linux driver should be
+   made capable of working in both modes, and proper ioctls (see later) should
+   be made available at user-level ...
From: Grant Edwards
Date: Tuesday, October 19, 2010 - 7:29 am

Pardon my curiosity, but I've looked at a few AT91 parts, and I've
never seen on with an internal transceiver -- nor does Google seem
able to find any.

Frankly, I'd be pretty surprised, since it would be very difficult
(fab-wise), to build a mircoprocessor with I/O cells capable of
withstanding the voltage levels specified in RS232.

Can you specify to which parts you're referring?

-- 
Grant Edwards               grant.b.edwards        Yow! I have the power to
                                  at               HALT PRODUCTION on all
                              gmail.com            TEENAGE SEX COMEDIES!!

--

From: Alexander Stein
Date: Tuesday, October 19, 2010 - 8:27 am

I doubt the AT91 do have an internal transceiver but it has a dedicated pin 
feature (RTS or CTS or something) which can be used to switch between RS232 
and RS485 by setting a bit in the USART provided the pin is connected 
properly.

Regards,
Alexander
--

From: Alexander Stein
Date: Wednesday, October 20, 2010 - 1:00 am

Out of curiosity, how can I add RS485 (or whatever) support for other serial 
devices like e.g. i.mx serial? Is there some driver independent interface 
which only gets filled in board configs like setting some GPIO pins?

Alexander
--

From: Alan Cox
Date: Wednesday, October 20, 2010 - 11:56 am

On Wed, 20 Oct 2010 10:00:14 +0200

Several devices support RS485 and the like

There are two interfaces

1.	termiox	which is used in the old Unix world for sync and
other stuff on serial world. Linux now supports a bit of this interface
and has the flags so we can grow it as needed. It covers one way flow
control

2.	TIOCGSRS485/TIOCSRS486 plus struct serial_rs485 which is Linux
specific but also allows for pre/post send delays in hardware that some
chips can do.

And nothing stops you supporting both interfaces when it makes sense
--

From: Claudio Scordino
Date: Sunday, October 24, 2010 - 4:29 am

Hi all,

	sorry for the misuse of the term "transceiver", and thank you
for your corrections.

Hopefully, this new version of the document is slightly better.

Many thanks,

	Claudio	


Documentation about RS485 serial communications

Signed-off-by: Claudio Scordino <claudio@evidence.eu.com>
---
 Documentation/serial/00-INDEX         |    2 +
 Documentation/serial/serial-rs485.txt |  119 +++++++++++++++++++++++++++++++++
 2 files changed, 121 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/serial/serial-rs485.txt

diff --git a/Documentation/serial/00-INDEX b/Documentation/serial/00-INDEX
index 07dcdb0..e09468a 100644
--- a/Documentation/serial/00-INDEX
+++ b/Documentation/serial/00-INDEX
@@ -14,6 +14,8 @@ riscom8.txt
 	- notes on using the RISCom/8 multi-port serial driver.
 rocket.txt
 	- info on the Comtrol RocketPort multiport serial driver.
+serial-rs485.txt
+	- info about RS485 structures and support in the kernel.
 specialix.txt
 	- info on hardware/driver for specialix IO8+ multiport serial card.
 stallion.txt
diff --git a/Documentation/serial/serial-rs485.txt b/Documentation/serial/serial-rs485.txt
new file mode 100644
index 0000000..40f09c6
--- /dev/null
+++ b/Documentation/serial/serial-rs485.txt
@@ -0,0 +1,119 @@
+                        RS485 SERIAL COMMUNICATIONS
+
+1. INTRODUCTION
+
+   EIA-485, also known as TIA/EIA-485 or RS-485, is a standard defining the
+   electrical characteristics of drivers and receivers for use in balanced
+   digital multipoint systems.
+   This standard is widely used for communications in industrial automation
+   because it can be used effectively over long distances and in electrically
+   noisy environments.
+
+2. HARDWARE-RELATED CONSIDERATIONS
+
+   Some CPUs (e.g., Atmel AT91) contain a built-in half-duplex mode capable of
+   automatically controlling line direction by toggling RTS. That can used to
+   control external half-duplex hardware like an RS485 transceiver or any
+   ...
From: Nicolas Ferre
Date: Wednesday, November 10, 2010 - 2:17 am

Le 24/10/2010 13:29, Claudio Scordino :


Hi all,

This documentation is floating around for some time now. Claudio has
enhanced it and it is maybe time to merge it in mainline...

So, can serial people include it in their tree (Greg?) or should it go
through another path?

Thanks to all of you.



-- 
Nicolas Ferre

--

From: Greg KH
Date: Wednesday, November 10, 2010 - 10:28 am

I can take it, if someone resends it with the accumulated acks that I
think it gathered over the review cycle.

thanks,

greg k-h
--

From: Claudio Scordino
Date: Thursday, November 11, 2010 - 3:22 am

Here it is.

Thanks,

	Claudio


Documentation about RS485 serial communications

Signed-off-by: Claudio Scordino <claudio@evidence.eu.com>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Acked-by: Russell King <linux@arm.linux.org.uk>
Acked-by: Grant Edwards <grant.b.edwards@gmail.com>
---
 Documentation/serial/00-INDEX         |    2 +
 Documentation/serial/serial-rs485.txt |  119 +++++++++++++++++++++++++++++++++
 2 files changed, 121 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/serial/serial-rs485.txt

diff --git a/Documentation/serial/00-INDEX b/Documentation/serial/00-INDEX
index 07dcdb0..e09468a 100644
--- a/Documentation/serial/00-INDEX
+++ b/Documentation/serial/00-INDEX
@@ -14,6 +14,8 @@ riscom8.txt
 	- notes on using the RISCom/8 multi-port serial driver.
 rocket.txt
 	- info on the Comtrol RocketPort multiport serial driver.
+serial-rs485.txt
+	- info about RS485 structures and support in the kernel.
 specialix.txt
 	- info on hardware/driver for specialix IO8+ multiport serial card.
 stallion.txt
diff --git a/Documentation/serial/serial-rs485.txt b/Documentation/serial/serial-rs485.txt
new file mode 100644
index 0000000..40f09c6
--- /dev/null
+++ b/Documentation/serial/serial-rs485.txt
@@ -0,0 +1,119 @@
+                        RS485 SERIAL COMMUNICATIONS
+
+1. INTRODUCTION
+
+   EIA-485, also known as TIA/EIA-485 or RS-485, is a standard defining the
+   electrical characteristics of drivers and receivers for use in balanced
+   digital multipoint systems.
+   This standard is widely used for communications in industrial automation
+   because it can be used effectively over long distances and in electrically
+   noisy environments.
+
+2. HARDWARE-RELATED CONSIDERATIONS
+
+   Some CPUs (e.g., Atmel AT91) contain a built-in half-duplex mode capable of
+   automatically controlling line direction by toggling RTS. That can used to
+   control external half-duplex hardware like an RS485 transceiver or any
+   RS232-connected ...
From: Pavel Machek
Date: Tuesday, November 16, 2010 - 7:30 am

I have seen hardware (kontron pmc-6l) that was capable of switching
between RS232, RS485 and one other standard by software.


IOW... is this supposed to switch electrical levels?

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--

From: Alexander Stein
Date: Tuesday, November 16, 2010 - 8:28 am

Hello,



Especially in industrial system, you may have RS485 or RS422 additionally to 
RS232. This also often means switching some GPIO to change the external signal 
levels. Any the drivers must also be capable of turning on and off the 
transmitter.

Best regards,
Alexander
--

From: Matt Schulte
Date: Tuesday, November 16, 2010 - 9:13 am

In my opinion this type of card is not that common.  Generally
speaking the achievable baud rates for this type of multi-protocol
card are very limited because of limitations of the transceiver chips.
 It seems that most of the time people would rather have a faster
serial port than one that does several different voltages.

Matt Schulte
--

From: Alan Cox
Date: Tuesday, November 16, 2010 - 10:20 am

On Tue, 16 Nov 2010 10:13:22 -0600

If there are two types in common use then thats enough to say we should
have a common interface IMHO
--

From: Grant Edwards
Date: Tuesday, November 16, 2010 - 11:03 am

Comtrol, Moxa, B&B, Sealevel, and others all sell PCI cards and
Ethernet attached serial ports that have selectable interfaces
(typically RS-232/422/485).  Comtrol and Moxa have had drivers in the
kernel tree for ages, but they've always had to use custom ioctl calls
for things like configuring 232/485/422 mode and half/full-duplex
mode.

There are also tons of small Linux-based industrial server appliances
from Comtrol, Silex, Digi, Moxa, and others that have selectable
interface serial ports.

Having a standard API for things like interface mode, half-full
duplex, inter-character timeout, 9-bit mode, and so on would be life a
lot easier for those of us who maintain Linux serial drivers...

-- 
Grant Edwards               grant.b.edwards        Yow! I always have fun
                                  at               because I'm out of my
                              gmail.com            mind!!!

--

From: Alan Cox
Date: Tuesday, November 16, 2010 - 1:04 pm

Ok so what is needed that isn't covered by the current termiox and

9bit mode is a real problem with the tty layer defined in terms of 8bit
streams but yes.
--

From: Pavel Machek
Date: Tuesday, November 30, 2010 - 12:19 pm

Well, if you wanted to have some fun... kontron card is able to
timestamp incoming characters, and saves state of the control signals
when character is received...
								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--

From: Matt Schulte
Date: Tuesday, November 16, 2010 - 11:41 am

On Tue, Nov 16, 2010 at 10:28 AM, Grant Edwards

In my world 460kbps for an RS422 card is slow.  RS422 cards generally
push multi megabit/s rates.

Matt Schulte
--

From: Haavard Skinnemoen
Date: Friday, May 28, 2010 - 2:42 am

My fault too...I should really try harder to respond to e-mails. I was
planning to give it a spin and send it upstream, but I never found the
time.

Nicolas, is it ok if I send a patch to update MAINTAINERS? That way,
you'll receive these patches and questions about them by e-mail rather
than me.

Haavard
--

From: Nicolas Ferre
Date: Friday, May 28, 2010 - 6:54 am

I take over the maintenance of SPI, USART, Ethernet and USB gadget drivers.
Those drivers are found in Atmel microcontrollers, both AT32/AVR32 and
AT91/ARM.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
Haavard,
I finally change the MAINTAINERS entries for all drivers that you were
taking care of. I must admit that I was a bit frighten at the first place but
anyway, since one year, I am getting used to it ;-)


 MAINTAINERS |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 33047a6..d9ce9c6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1148,7 +1148,7 @@ F:	drivers/mmc/host/atmel-mci.c
 F:	drivers/mmc/host/atmel-mci-regs.h
 
 ATMEL AT91 / AT32 SERIAL DRIVER
-M:	Haavard Skinnemoen <hskinnemoen@atmel.com>
+M:	Nicolas Ferre <nicolas.ferre@atmel.com>
 S:	Supported
 F:	drivers/serial/atmel_serial.c
 
@@ -1160,18 +1160,18 @@ F:	drivers/video/atmel_lcdfb.c
 F:	include/video/atmel_lcdc.h
 
 ATMEL MACB ETHERNET DRIVER
-M:	Haavard Skinnemoen <hskinnemoen@atmel.com>
+M:	Nicolas Ferre <nicolas.ferre@atmel.com>
 S:	Supported
 F:	drivers/net/macb.*
 
 ATMEL SPI DRIVER
-M:	Haavard Skinnemoen <hskinnemoen@atmel.com>
+M:	Nicolas Ferre <nicolas.ferre@atmel.com>
 S:	Supported
 F:	drivers/spi/atmel_spi.*
 
 ATMEL USBA UDC DRIVER
-M:	Haavard Skinnemoen <hskinnemoen@atmel.com>
-L:	kernel@avr32linux.org
+M:	Nicolas Ferre <nicolas.ferre@atmel.com>
+L:	linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 W:	http://avr32linux.org/twiki/bin/view/Main/AtmelUsbDeviceDriver
 S:	Supported
 F:	drivers/usb/gadget/atmel_usba_udc.*
-- 
1.5.6.5

--

From: Haavard Skinnemoen
Date: Friday, May 28, 2010 - 6:31 am

Good to hear that you're getting the hang of it :-)

Haavard
--

From: Nicolas Ferre
Date: Friday, June 11, 2010 - 12:23 am

Ping,

With added acked-by:


-- 
Nicolas Ferre

--

Previous thread: linux-next: build failure after merge of the slabh tree by Stephen Rothwell on Sunday, March 28, 2010 - 11:55 pm. (2 messages)

Next thread: [PATCH] x86, MCE, fix MSR_IA32_MCI_CTL2 CMCI threshold setup by Huang Ying on Monday, March 29, 2010 - 12:16 am. (4 messages)