1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
From dfe822a2848987263b7ac30b1c20e89d86f63caa Mon Sep 17 00:00:00 2001
From: Magnus Damm <damm+renesas@opensource.se>
Date: Thu, 19 Mar 2015 10:49:53 +0900
Subject: [PATCH 15/18] serial: sh-sci: Fix default RTS handling
Fix the default SCIF handling in case CTS/RTS is available
on the target board but disabled by user space. Without
this patch the RTS output value is not set.
Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
---
drivers/tty/serial/sh-sci.c | 7 +++++--
include/linux/serial_sci.h | 1 +
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 8465cfd..64bf5b6 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -535,10 +535,13 @@ static void sci_init_ctsrts_default(struct uart_port *port, bool hwflow_enabled)
if (!reg->size || hwflow_enabled)
return;
+ /* Setup CTS/RTS in the case hardware flow is disabled by user space.
+ * The CTS signal is setup as input and RTS as output with value 0.
+ */
status = serial_port_in(port, SCSPTR);
- status &= ~SCSPTR_CTSIO;
+ status &= ~(SCSPTR_CTSIO | SCSPTR_RTSDT);
status |= SCSPTR_RTSIO;
- serial_port_out(port, SCSPTR, status); /* Set RTS = 1 */
+ serial_port_out(port, SCSPTR, status); /* Set RTS = 0 */
}
static void sci_init_pins(struct uart_port *port, unsigned int cflag)
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index e730b58..39884de 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -57,6 +57,7 @@
/* SCSPTR (Serial Port Register), optional */
#define SCSPTR_RTSIO (1 << 7) /* Serial Port RTS Pin Input/Output */
+#define SCSPTR_RTSDT (1 << 6) /* Serial Port RTS Pin Data */
#define SCSPTR_CTSIO (1 << 5) /* Serial Port CTS Pin Input/Output */
#define SCSPTR_SPB2IO (1 << 1) /* Serial Port Break Input/Output */
#define SCSPTR_SPB2DT (1 << 0) /* Serial Port Break Data */
--
1.7.10.4
|