summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2021-11-29 12:53:26 -0600
committerJohn Klug <john.klug@multitech.com>2021-11-29 12:53:26 -0600
commit27c7c81c103adbd1dff4e1c5abf977f305e56310 (patch)
tree5524ac19cdaa0961619e5dbb6eeee03435b88dc7
parente2d419909faa35ec0130b439caf9fde65a85056a (diff)
downloadmeta-multitech-atmel-27c7c81c103adbd1dff4e1c5abf977f305e56310.tar.gz
meta-multitech-atmel-27c7c81c103adbd1dff4e1c5abf977f305e56310.tar.bz2
meta-multitech-atmel-27c7c81c103adbd1dff4e1c5abf977f305e56310.zip
Disable CRTSCTS when setting RS485 half duplex to match Vizzini driver
-rw-r--r--recipes-kernel/linux/linux-at91-4.9.87/mtcdt/linux-4.9-rs485-atmel-crtscts.patch20
-rw-r--r--recipes-kernel/linux/linux-at91_4.9.87.bb1
2 files changed, 21 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/linux-4.9-rs485-atmel-crtscts.patch b/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/linux-4.9-rs485-atmel-crtscts.patch
new file mode 100644
index 0000000..1cf147e
--- /dev/null
+++ b/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/linux-4.9-rs485-atmel-crtscts.patch
@@ -0,0 +1,20 @@
+This patch allows RS485 Half Duplex (ATMEL_US_USMODE_RS485 is half duplex) to
+work even if handshaking is turned on. This mimics the behavior of the EXAR
+USB/Serial driver known as Vizzini. It is impossible to use handshaking when
+using ATMEL_US_USMODE_RS485. This provides compatibility between MTCDT-0.1 and
+MTCDT-0.2.
+=======================================================================================
+diff -Naru orig/drivers/tty/serial/atmel_serial.c new/drivers/tty/serial/atmel_serial.c
+--- orig/drivers/tty/serial/atmel_serial.c 2021-11-29 12:29:38.472076748 -0600
++++ new/drivers/tty/serial/atmel_serial.c 2021-11-29 12:26:05.668072459 -0600
+@@ -2171,7 +2171,10 @@
+ atmel_uart_writel(port, ATMEL_US_TTGR,
+ port->rs485.delay_rts_after_send);
+ mode |= ATMEL_US_USMODE_RS485;
++ /* CRTSCTS is impossible in RS485 mode, and breaks the driver
++ * so we cannot do a send. */
++ termios->c_cflag &= ~CRTSCTS;
+ } else if (termios->c_cflag & CRTSCTS) {
+ /* RS232 with hardware handshake (RTS/CTS) */
+ if (atmel_use_fifo(port) &&
+ !mctrl_gpio_to_gpiod(atmel_port->gpios, UART_GPIO_CTS)) {
diff --git a/recipes-kernel/linux/linux-at91_4.9.87.bb b/recipes-kernel/linux/linux-at91_4.9.87.bb
index b6df5b8..fc50f0d 100644
--- a/recipes-kernel/linux/linux-at91_4.9.87.bb
+++ b/recipes-kernel/linux/linux-at91_4.9.87.bb
@@ -64,6 +64,7 @@ SRC_URI_append_mtcdt = "\
file://mt-at91.h \
file://linux-4.9-mtcdt-device-tree.patch \
file://linux-4.9-mtcdt-atmel-multidrop.patch \
+ file://linux-4.9-rs485-atmel-crtscts.patch \
"
SRC_URI_append_mtrv1 = "\
${COMMON_PATCHES} \