[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4C03D3F1.9040104@evidence.eu.com>
Date: Mon, 31 May 2010 17:21:21 +0200
From: Claudio Scordino <claudio@...dence.eu.com>
To: Philippe De Muyter <phdm@...qel.be>
CC: hskinnemoen@...el.com, Nicolas Ferre <nicolas.ferre@...el.com>,
Alan Cox <alan@...rguk.ukuu.org.uk>,
Bernhard Roth <br@...net.de>, Rick Bronson <rick@....org>,
John Nicholls <john@...nlinx.com>,
Sebastian Heutling <Sebastian.Heutling@...-ing.de>,
Ryan Mallon <ryan@...ewatersys.com>,
michael trimarchi <michael@...dence.eu.com>,
Konrad Mattheis <mattheis@...a.de>,
Elektrolot <elektrolot@...pl>,
Prchal Jiří <jiri.prchal@...ignal.cz>,
akpm@...ux-foundation.org,
Linux Kernel <linux-kernel@...r.kernel.org>,
linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
linux@...im.org.za
Subject: Re: [PATCH] General fixes in the serial_rs485 structure
Philippe De Muyter ha scritto:
> On Mon, May 31, 2010 at 03:39:37PM +0200, Claudio Scordino wrote:
>
>> diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
>> index eed3c2d..1adb1bf 100644
>> --- a/drivers/serial/atmel_serial.c
>> +++ b/drivers/serial/atmel_serial.c
>> @@ -216,7 +216,7 @@ void atmel_config_rs485(struct uart_port *port, struct serial_rs485 *rs485conf)
>> if (rs485conf->flags & SER_RS485_ENABLED) {
>> dev_dbg(port->dev, "Setting UART to RS485\n");
>> atmel_port->tx_done_mask = ATMEL_US_TXEMPTY;
>> - UART_PUT_TTGR(port, rs485conf->delay_rts_before_send);
>> + UART_PUT_TTGR(port, rs485conf->delay_rts_after_send);
>> mode |= ATMEL_US_USMODE_RS485;
>> } else {
>> dev_dbg(port->dev, "Setting UART to RS232\n");
>
> Should the usage of delay_rts_after_send not depend on
> (flags & SER_RS485_RTS_AFTER_SEND) also ?
You're right. Sorry for the oversight.
This is the patch fixed.
Many thanks,
Claudio
==========================
New fields in structure serial_rs485.
This patch fixes several issues related to the RS485 interface:
- It adds the flag SER_RS485_RTS_BEFORE_SEND that was missing from the
serial_rs485 structure (even if "delay_rts_before_send" was existing)
- It adds a further "delay_rts_after_send" field for those drivers that
can have a delay after send (e.g., atmel_serial)
- It fixes the usage of the structure in the atmel_serial driver (where
"delay_rts_before_send" should be used instead of "delay_rts_after_send").
Signed-off-by: Claudio Scordino <claudio@...dence.eu.com>
Signed-off-by: Bernhard Roth <br@...net.de>
---
drivers/serial/atmel_serial.c | 11 ++++++++---
include/linux/serial.h | 4 +++-
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index eed3c2d..6a33546 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -216,7 +216,8 @@ void atmel_config_rs485(struct uart_port *port, struct serial_rs485 *rs485conf)
if (rs485conf->flags & SER_RS485_ENABLED) {
dev_dbg(port->dev, "Setting UART to RS485\n");
atmel_port->tx_done_mask = ATMEL_US_TXEMPTY;
- UART_PUT_TTGR(port, rs485conf->delay_rts_before_send);
+ if (rs485conf->flags & SER_RS485_RTS_AFTER_SEND)
+ UART_PUT_TTGR(port, rs485conf->delay_rts_after_send);
mode |= ATMEL_US_USMODE_RS485;
} else {
dev_dbg(port->dev, "Setting UART to RS232\n");
@@ -291,7 +292,9 @@ static void atmel_set_mctrl(struct uart_port *port, u_int mctrl)
if (atmel_port->rs485.flags & SER_RS485_ENABLED) {
dev_dbg(port->dev, "Setting UART to RS485\n");
- UART_PUT_TTGR(port, atmel_port->rs485.delay_rts_before_send);
+ if (atmel_port->rs485.flags & SER_RS485_RTS_AFTER_SEND)
+ UART_PUT_TTGR(port,
+ atmel_port->rs485.delay_rts_after_send);
mode |= ATMEL_US_USMODE_RS485;
} else {
dev_dbg(port->dev, "Setting UART to RS232\n");
@@ -1210,7 +1213,9 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios,
if (atmel_port->rs485.flags & SER_RS485_ENABLED) {
dev_dbg(port->dev, "Setting UART to RS485\n");
- UART_PUT_TTGR(port, atmel_port->rs485.delay_rts_before_send);
+ if (atmel_port->rs485.flags & SER_RS485_RTS_AFTER_SEND)
+ UART_PUT_TTGR(port,
+ atmel_port->rs485.delay_rts_after_send);
mode |= ATMEL_US_USMODE_RS485;
} else {
dev_dbg(port->dev, "Setting UART to RS232\n");
diff --git a/include/linux/serial.h b/include/linux/serial.h
index c8613c3..f9a0b67 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -210,8 +210,10 @@ struct serial_rs485 {
#define SER_RS485_ENABLED (1 << 0)
#define SER_RS485_RTS_ON_SEND (1 << 1)
#define SER_RS485_RTS_AFTER_SEND (1 << 2)
+#define SER_RS485_RTS_BEFORE_SEND (1 << 3)
__u32 delay_rts_before_send; /* Milliseconds */
- __u32 padding[6]; /* Memory is cheap, new structs
+ __u32 delay_rts_after_send; /* Milliseconds */
+ __u32 padding[5]; /* Memory is cheap, new structs
are a royal PITA .. */
};
--
1.6.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists