Skip to contentSkip to conversation

atmel_serial: fix RTS high after initialization in RS485 mode

PATCH Claudio Scordino 2 participants 2 messages Oct 24, 2010 – Oct 25, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Nicolas,

when working in RS485 mode, the atmel_serial driver keeps RTS
high after the initialization of the serial port. It goes low only after the first character has been sent.

This patch fixes this behavior. It has been already tested by Arkadiusz (CC:-ed).

Best regards,

Claudio

atmel_serial: RTS line low after initialization of the serial port

---
 drivers/serial/atmel_serial.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
drivers/serial/atmel_serial.c +9 -0
index 3892666..85aa66f 100644
@@ -1732,6 +1732,15 @@ static int __devinit atmel_serial_probe(struct platform_device *pdev)
 	device_init_wakeup(&pdev->dev, 1);
 	platform_set_drvdata(pdev, port);
 
+	if (port->rs485.flags & SER_RS485_ENABLED) {
+		unsigned int control = 0;
+		unsigned int mode = 0;
+		control |= ATMEL_US_RTSEN;
+		mode |= ATMEL_US_USMODE_NORMAL;
+		UART_PUT_MR(&port->uart, mode);
+		UART_PUT_CR(&port->uart, control);
+	}
+
 	return 0;
 
 err_add_port:
Signature · 1 line
1.6.0.4
#1 lore raw
Quoted 30 lines · On Sun, 24 Oct 2010 12:48:29 +0200 Claudio Scordino <[email protected]>…

Hi Nicolas,

when working in RS485 mode, the atmel_serial driver keeps RTS
high after the initialization of the serial port. It goes low only after the first character has been sent.

This patch fixes this behavior. It has been already tested by Arkadiusz (CC:-ed).

Best regards,

Claudio

atmel_serial: RTS line low after initialization of the serial port

---
 drivers/serial/atmel_serial.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
drivers/serial/atmel_serial.c +1 -0
index 3892666..85aa66f 100644
@@ -1732,6 +1732,15 @@ static int __devinit atmel_serial_probe(struct platform_device *pdev)
 	device_init_wakeup(&pdev->dev, 1);
 	platform_set_drvdata(pdev, port);
 
+	if (port->rs485.flags & SER_RS485_ENABLED) {

drivers/serial/atmel_serial.c static int __devinit atmel_serial_probe(struct platform_device *pdev) · line 1745

Quoted 10 lines
drivers/serial/atmel_serial.c +8 -0
+		unsigned int control = 0;
+		unsigned int mode = 0;
+		control |= ATMEL_US_RTSEN;
+		mode |= ATMEL_US_USMODE_NORMAL;
+		UART_PUT_MR(&port->uart, mode);
+		UART_PUT_CR(&port->uart, control);
+	}
+
 	return 0;
 

That was a lot of code! How about just this?

	if (port->rs485.flags & SER_RS485_ENABLED) {
		UART_PUT_MR(&port->uart, ATMEL_US_USMODE_NORMAL);
		UART_PUT_CR(&port->uart, ATMEL_US_RTSEN);
	}