All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] atmel-serial: fix RS485 half-duplex problem
@ 2012-03-27 17:43 Siftar, Gabe
  2012-03-27 17:54   ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Siftar, Gabe @ 2012-03-27 17:43 UTC (permalink / raw)
  To: linux-arm-kernel, linux-serial
  Cc: Greg Kroah-Hartman, Andrew Victor, Nicolas Ferre,
	Jean-Christophe PLAGNIOL-VILLARD, Claudio Scordino,
	Bernhard Roth

On our custom board, we are using RS485 in half-duplex mode on an AT91SAM9G45. 
SER_RS485_RX_DURING_TX is not set as we do not want to receive the data we 
transmit (our transceiver will receive transmitted data).  Although the current 
driver attempts to disable and enable the receiver at the appropriate points, 
incoming data is still loaded into the receive register causing our code to 
receive the very last byte that was sent once the receiver is enabled.
 
I ran this by Atmel support and they wrote:  "The issue comes from the fact 
that you disable the PDC/DMA Reception and not the USART Reception channel.  In 
your case, the[n] you will still receive data into the USART_RHR register, and 
maybe you [h]ave the overun flag set.  So please disable the USART reception 
channel."
  
The following patch should force the driver to enable/disable the receiver via 
RXEN/RXDIS fields of the USART control register.  It fixed the issue I was 
having - perhaps others will find it useful as well.

Signed-off-by: Gabe Siftar <gabe.siftar@getingeusa.com>

Index: linux-3.3/drivers/tty/serial/atmel_serial.c
===================================================================
--- linux-3.3.orig/drivers/tty/serial/atmel_serial.c
+++ linux-3.3/drivers/tty/serial/atmel_serial.c
@@ -395,6 +395,8 @@
 {
 	UART_PUT_CR(port, ATMEL_US_RSTSTA);  /* reset status and receiver */
 
+	UART_PUT_CR(port, ATMEL_US_RXEN);
+
 	if (atmel_use_dma_rx(port)) {
 		/* enable PDC controller */
 		UART_PUT_IER(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT |
@@ -410,6 +412,8 @@
  */
 static void atmel_stop_rx(struct uart_port *port)
 {
+	UART_PUT_CR(port, ATMEL_US_RXDIS);
+	
 	if (atmel_use_dma_rx(port)) {
 		/* disable PDC receive */
 		UART_PUT_PTCR(port, ATMEL_PDC_RXTDIS);

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.

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

* Re: [PATCH] atmel-serial: fix RS485 half-duplex problem
  2012-03-27 17:43 [PATCH] atmel-serial: fix RS485 half-duplex problem Siftar, Gabe
@ 2012-03-27 17:54   ` Greg KH
  0 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2012-03-27 17:54 UTC (permalink / raw)
  To: Siftar, Gabe
  Cc: linux-arm-kernel, linux-serial, Andrew Victor, Nicolas Ferre,
	Jean-Christophe PLAGNIOL-VILLARD, Claudio Scordino,
	Bernhard Roth

On Tue, Mar 27, 2012 at 01:43:39PM -0400, Siftar, Gabe wrote:
> On our custom board, we are using RS485 in half-duplex mode on an AT91SAM9G45. 
> SER_RS485_RX_DURING_TX is not set as we do not want to receive the data we 
> transmit (our transceiver will receive transmitted data).  Although the current 
> driver attempts to disable and enable the receiver at the appropriate points, 
> incoming data is still loaded into the receive register causing our code to 
> receive the very last byte that was sent once the receiver is enabled.
>  
> I ran this by Atmel support and they wrote:  "The issue comes from the fact 
> that you disable the PDC/DMA Reception and not the USART Reception channel.  In 
> your case, the[n] you will still receive data into the USART_RHR register, and 
> maybe you [h]ave the overun flag set.  So please disable the USART reception 
> channel."
>   
> The following patch should force the driver to enable/disable the receiver via 
> RXEN/RXDIS fields of the USART control register.  It fixed the issue I was 
> having - perhaps others will find it useful as well.
> 
> Signed-off-by: Gabe Siftar <gabe.siftar@getingeusa.com>

That's nice, but:

> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.--

This footer just contridicted your signed-off-by:

So, what should I believe?

Hint, please remove such footers, and tell anyone who insists on them
that they directly prevent you from contributing to the kernel, as I can
not accept patches with this on it.

Care to resend this without the footer so I can accept it?

greg k-h

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

* [PATCH] atmel-serial: fix RS485 half-duplex problem
@ 2012-03-27 17:54   ` Greg KH
  0 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2012-03-27 17:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 27, 2012 at 01:43:39PM -0400, Siftar, Gabe wrote:
> On our custom board, we are using RS485 in half-duplex mode on an AT91SAM9G45. 
> SER_RS485_RX_DURING_TX is not set as we do not want to receive the data we 
> transmit (our transceiver will receive transmitted data).  Although the current 
> driver attempts to disable and enable the receiver at the appropriate points, 
> incoming data is still loaded into the receive register causing our code to 
> receive the very last byte that was sent once the receiver is enabled.
>  
> I ran this by Atmel support and they wrote:  "The issue comes from the fact 
> that you disable the PDC/DMA Reception and not the USART Reception channel.  In 
> your case, the[n] you will still receive data into the USART_RHR register, and 
> maybe you [h]ave the overun flag set.  So please disable the USART reception 
> channel."
>   
> The following patch should force the driver to enable/disable the receiver via 
> RXEN/RXDIS fields of the USART control register.  It fixed the issue I was 
> having - perhaps others will find it useful as well.
> 
> Signed-off-by: Gabe Siftar <gabe.siftar@getingeusa.com>

That's nice, but:

> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.--

This footer just contridicted your signed-off-by:

So, what should I believe?

Hint, please remove such footers, and tell anyone who insists on them
that they directly prevent you from contributing to the kernel, as I can
not accept patches with this on it.

Care to resend this without the footer so I can accept it?

greg k-h

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

* RE: [PATCH] atmel-serial: fix RS485 half-duplex problem
  2012-03-27 17:54   ` Greg KH
  (?)
@ 2012-03-27 20:20   ` Siftar, Gabe
  2012-03-27 20:26       ` Greg KH
  -1 siblings, 1 reply; 8+ messages in thread
From: Siftar, Gabe @ 2012-03-27 20:20 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-arm-kernel, linux-serial, Andrew Victor, Nicolas Ferre,
	Jean-Christophe PLAGNIOL-VILLARD, Claudio Scordino,
	Bernhard Roth

>From: Greg KH [mailto:gregkh@linuxfoundation.org]
>Sent: Tuesday, March 27, 2012 1:55 PM
>Care to resend this without the footer so I can accept it?

Sorry.  It turns out that the footer was added by our 3rd party email 
filtering service - I hope that it's no longer being included.

On our custom board, we are using RS485 in half-duplex mode on an AT91SAM9G45. 
SER_RS485_RX_DURING_TX is not set as we do not want to receive the data we 
transmit (our transceiver will receive transmitted data).  Although the current 
driver attempts to disable and enable the receiver at the appropriate points, 
incoming data is still loaded into the receive register causing our code to 
receive the very last byte that was sent once the receiver is enabled.
 
I ran this by Atmel support and they wrote:  "The issue comes from the fact 
that you disable the PDC/DMA Reception and not the USART Reception channel.  In 
your case, the[n] you will still receive data into the USART_RHR register, and 
maybe you [h]ave the overun flag set.  So please disable the USART reception 
channel."
  
The following patch should force the driver to enable/disable the receiver via 
RXEN/RXDIS fields of the USART control register.  It fixed the issue I was 
having - perhaps others will find it useful as well.

Signed-off-by: Gabe Siftar <gabe.siftar@getingeusa.com>

Index: linux-3.3/drivers/tty/serial/atmel_serial.c
===================================================================
--- linux-3.3.orig/drivers/tty/serial/atmel_serial.c
+++ linux-3.3/drivers/tty/serial/atmel_serial.c
@@ -395,6 +395,8 @@
 {
 	UART_PUT_CR(port, ATMEL_US_RSTSTA);  /* reset status and receiver */
 
+	UART_PUT_CR(port, ATMEL_US_RXEN);
+
 	if (atmel_use_dma_rx(port)) {
 		/* enable PDC controller */
 		UART_PUT_IER(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT |
@@ -410,6 +412,8 @@
  */
 static void atmel_stop_rx(struct uart_port *port)
 {
+	UART_PUT_CR(port, ATMEL_US_RXDIS);
+	
 	if (atmel_use_dma_rx(port)) {
 		/* disable PDC receive */
 		UART_PUT_PTCR(port, ATMEL_PDC_RXTDIS);


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

* Re: [PATCH] atmel-serial: fix RS485 half-duplex problem
  2012-03-27 20:20   ` Siftar, Gabe
@ 2012-03-27 20:26       ` Greg KH
  0 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2012-03-27 20:26 UTC (permalink / raw)
  To: Siftar, Gabe
  Cc: linux-arm-kernel, linux-serial, Andrew Victor, Nicolas Ferre,
	Jean-Christophe PLAGNIOL-VILLARD, Claudio Scordino,
	Bernhard Roth

On Tue, Mar 27, 2012 at 04:20:51PM -0400, Siftar, Gabe wrote:
> >From: Greg KH [mailto:gregkh@linuxfoundation.org]
> >Sent: Tuesday, March 27, 2012 1:55 PM
> >Care to resend this without the footer so I can accept it?
> 
> Sorry.  It turns out that the footer was added by our 3rd party email 
> filtering service - I hope that it's no longer being included.

Looks good, thanks, I'll queue this up once 3.4-rc1 is out.

thanks,

greg k-h

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

* [PATCH] atmel-serial: fix RS485 half-duplex problem
@ 2012-03-27 20:26       ` Greg KH
  0 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2012-03-27 20:26 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 27, 2012 at 04:20:51PM -0400, Siftar, Gabe wrote:
> >From: Greg KH [mailto:gregkh at linuxfoundation.org]
> >Sent: Tuesday, March 27, 2012 1:55 PM
> >Care to resend this without the footer so I can accept it?
> 
> Sorry.  It turns out that the footer was added by our 3rd party email 
> filtering service - I hope that it's no longer being included.

Looks good, thanks, I'll queue this up once 3.4-rc1 is out.

thanks,

greg k-h

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

* [PATCH] tty/serial: atmel_serial: fix RS485 half-duplex problem
  2012-03-27 20:26       ` Greg KH
@ 2012-03-29 13:40         ` Nicolas Ferre
  -1 siblings, 0 replies; 8+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:40 UTC (permalink / raw)
  To: gregkh
  Cc: Gabe.Siftar, linux-arm-kernel, linux-serial, plagnioj, linux,
	claudio, br, Nicolas Ferre

From: "Siftar, Gabe" <Gabe.Siftar@getingeusa.com>

On our custom board, we are using RS485 in half-duplex mode on an AT91SAM9G45.
SER_RS485_RX_DURING_TX is not set as we do not want to receive the data we
transmit (our transceiver will receive transmitted data).
Although the current driver attempts to disable and enable the receiver at the
appropriate points, incoming data is still loaded into the receive register
causing our code to receive the very last byte that was sent once the receiver
is enabled.

I ran this by Atmel support and they wrote: "The issue comes from the fact
that you disable the PDC/DMA Reception and not the USART Reception channel. In
your case, the[n] you will still receive data into the USART_RHR register, and
maybe you [h]ave the overrun flag set. So please disable the USART reception
channel."

The following patch should force the driver to enable/disable the receiver via
RXEN/RXDIS fields of the USART control register. It fixed the issue I was
having.

Signed-off-by: Gabe Siftar <gabe.siftar@getingeusa.com>
[nicolas.ferre@atmel.com: slightly modify commit message]
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
Greg,

Here is an updated version of the patch that you received from Gabe. I have
removed a superfluous tab in empty line, remove commit message non needed parts
and added my "Signed-off-by" line.

Feel free to queue this version for 3.4-rc.

Thanks, best regards,
  Nicolas

 drivers/tty/serial/atmel_serial.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 10605ec..bc3cece 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -389,6 +389,8 @@ static void atmel_start_rx(struct uart_port *port)
 {
 	UART_PUT_CR(port, ATMEL_US_RSTSTA);  /* reset status and receiver */
 
+	UART_PUT_CR(port, ATMEL_US_RXEN);
+
 	if (atmel_use_dma_rx(port)) {
 		/* enable PDC controller */
 		UART_PUT_IER(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT |
@@ -404,6 +406,8 @@ static void atmel_start_rx(struct uart_port *port)
  */
 static void atmel_stop_rx(struct uart_port *port)
 {
+	UART_PUT_CR(port, ATMEL_US_RXDIS);
+
 	if (atmel_use_dma_rx(port)) {
 		/* disable PDC receive */
 		UART_PUT_PTCR(port, ATMEL_PDC_RXTDIS);
-- 
1.7.9.4


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

* [PATCH] tty/serial: atmel_serial: fix RS485 half-duplex problem
@ 2012-03-29 13:40         ` Nicolas Ferre
  0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: "Siftar, Gabe" <Gabe.Siftar@getingeusa.com>

On our custom board, we are using RS485 in half-duplex mode on an AT91SAM9G45.
SER_RS485_RX_DURING_TX is not set as we do not want to receive the data we
transmit (our transceiver will receive transmitted data).
Although the current driver attempts to disable and enable the receiver at the
appropriate points, incoming data is still loaded into the receive register
causing our code to receive the very last byte that was sent once the receiver
is enabled.

I ran this by Atmel support and they wrote: "The issue comes from the fact
that you disable the PDC/DMA Reception and not the USART Reception channel. In
your case, the[n] you will still receive data into the USART_RHR register, and
maybe you [h]ave the overrun flag set. So please disable the USART reception
channel."

The following patch should force the driver to enable/disable the receiver via
RXEN/RXDIS fields of the USART control register. It fixed the issue I was
having.

Signed-off-by: Gabe Siftar <gabe.siftar@getingeusa.com>
[nicolas.ferre at atmel.com: slightly modify commit message]
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
Greg,

Here is an updated version of the patch that you received from Gabe. I have
removed a superfluous tab in empty line, remove commit message non needed parts
and added my "Signed-off-by" line.

Feel free to queue this version for 3.4-rc.

Thanks, best regards,
  Nicolas

 drivers/tty/serial/atmel_serial.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 10605ec..bc3cece 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -389,6 +389,8 @@ static void atmel_start_rx(struct uart_port *port)
 {
 	UART_PUT_CR(port, ATMEL_US_RSTSTA);  /* reset status and receiver */
 
+	UART_PUT_CR(port, ATMEL_US_RXEN);
+
 	if (atmel_use_dma_rx(port)) {
 		/* enable PDC controller */
 		UART_PUT_IER(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT |
@@ -404,6 +406,8 @@ static void atmel_start_rx(struct uart_port *port)
  */
 static void atmel_stop_rx(struct uart_port *port)
 {
+	UART_PUT_CR(port, ATMEL_US_RXDIS);
+
 	if (atmel_use_dma_rx(port)) {
 		/* disable PDC receive */
 		UART_PUT_PTCR(port, ATMEL_PDC_RXTDIS);
-- 
1.7.9.4

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

end of thread, other threads:[~2012-03-29 13:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-27 17:43 [PATCH] atmel-serial: fix RS485 half-duplex problem Siftar, Gabe
2012-03-27 17:54 ` Greg KH
2012-03-27 17:54   ` Greg KH
2012-03-27 20:20   ` Siftar, Gabe
2012-03-27 20:26     ` Greg KH
2012-03-27 20:26       ` Greg KH
2012-03-29 13:40       ` [PATCH] tty/serial: atmel_serial: " Nicolas Ferre
2012-03-29 13:40         ` Nicolas Ferre

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.