* [PATCH v2 00/05] serial: sh-sci: Hardware flow control update V2
@ 2015-03-19 1:49 Magnus Damm
2015-03-19 1:49 ` [PATCH v2 01/05] serial: sh-sci: Break out default CTS/RTS pin setup Magnus Damm
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Magnus Damm @ 2015-03-19 1:49 UTC (permalink / raw)
To: linux-sh; +Cc: gregkh, geert, laurent.pinchart, linux-serial, Magnus Damm,
jslaby
serial: sh-sci: Hardware flow control update V2
[PATCH v2 01/05] serial: sh-sci: Break out default CTS/RTS pin setup
[PATCH v2 02/05] serial: sh-sci: Fix default RTS handling
[PATCH v2 03/05] serial: sh-sci: Expose default CTS pin
[PATCH v2 04/05] serial: sh-sci: Add SCIFA/SCIFB CTS/RTS pin setup
[PATCH v2 05/05] serial: sh-sci: Expose SCIFA/SCIFB CTS pin
These patches are my latest take at improving CTS/RTS pin handling in
the SCIF driver. The goal for these patches is to improve the default
hardware flow control handling and also add CTS/RTS support for SCIFA/SCIFB.
The SCIF hardware does not provide any interrupt driven delta monitoring
of any modem control signals such as CTS. Instead the different SCIF types
tend to include "automatic" hardware handling of the CTS and RTS signals.
Things like CTS/RTS pin setup, RTS trigger level and FIFO size seem to
vary with each SCIF variant, but the actual hardware flow control logic
should be the same if you trust the documentation. The hardware flow control
support can be enabled by setting the SCFCR.MCE bit in the hardware which
will enable the following behavior:
CTS: TX FIFO contents are sent as long as CTS remains asserted.
RTS: RTS is asserted as long as enough space remains in the RX FIFO.
Depending on SCIF variant it may be theoretically possible to enable hardware
handling of only one of the signals in the SCIF device. In other cases the pin
control hardware in the SoC may be used to disable handling of a certain pin.
Most embedded boards using SCIF tend to only hook up RX and TX signals while
some special cases like KZM9G have the SCIFA console port connected with CTS
and RTS signals available as well.
Getting support for CTS/RTS on a particular board involves the following:
- The SCIF variant on the SoC that has CTS/RTS support for the channel.
- The target board must enable all SCIF pins in the pin control hardware.
- The driver instance must be marked as CTS/RTS capable with SCIx_HAVE_RTSCTS.
- User space should signal that it wants to use CTS/RTS via CRTSCTS.
- In case CRTSCTS is not desired then the CTS/RTS pins need to be setup anyway.
At this point UPF_HARD_FLOW is not used by the driver.
Tested with local SCIx_HAVE_RTSCTS enablement on a KZM9G board with
probe points hooked up to a scope to monitor signal state.
Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---
Changes since V1:
- Adjusted function names, added bit definitions - thanks Laurent!
- Updated the RTS/CTS behavior when modem control is available but disabled.
Built on top of renesas-devel-20150311-v4.0-rc3
drivers/tty/serial/sh-sci.c | 148 +++++++++++++++++++++++++++++++++++++------
include/linux/serial_sci.h | 12 +++
2 files changed, 140 insertions(+), 20 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 01/05] serial: sh-sci: Break out default CTS/RTS pin setup
2015-03-19 1:49 [PATCH v2 00/05] serial: sh-sci: Hardware flow control update V2 Magnus Damm
@ 2015-03-19 1:49 ` Magnus Damm
2015-03-19 1:49 ` [PATCH v2 02/05] serial: sh-sci: Fix default RTS handling Magnus Damm
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Magnus Damm @ 2015-03-19 1:49 UTC (permalink / raw)
To: linux-sh; +Cc: gregkh, geert, laurent.pinchart, linux-serial, Magnus Damm,
jslaby
From: Magnus Damm <damm+renesas@opensource.se>
Break out CTS/RTS pin setup for the default case. We only
care about those pins in case SCIx_HAVE_RTSCTS is set.
Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---
Changes since V1:
- Function name change, thanks Laurent!
drivers/tty/serial/sh-sci.c | 45 +++++++++++++++++++++++++++++--------------
1 file changed, 31 insertions(+), 14 deletions(-)
--- 0001/drivers/tty/serial/sh-sci.c
+++ work/drivers/tty/serial/sh-sci.c 2015-03-19 09:07:40.616799151 +0900
@@ -509,10 +509,29 @@ static void sci_poll_put_char(struct uar
}
#endif /* CONFIG_CONSOLE_POLL || CONFIG_SERIAL_SH_SCI_CONSOLE */
-static void sci_init_pins(struct uart_port *port, unsigned int cflag)
+static void sci_init_ctsrts_default(struct uart_port *port, bool hwflow_enabled)
{
struct sci_port *s = to_sci_port(port);
struct plat_sci_reg *reg = sci_regmap[s->cfg->regtype] + SCSPTR;
+ unsigned short status;
+
+ /* If no SCSPTR register exists then skip. Same if hardware flow
+ * control has been enabled, in such case SCFCR.MCE will be set
+ * and the SCSPTR configuration is assumed to be overridden.
+ */
+ if (!reg->size || hwflow_enabled)
+ return;
+
+ status = serial_port_in(port, SCSPTR);
+ status &= ~SCSPTR_CTSIO;
+ status |= SCSPTR_RTSIO;
+ serial_port_out(port, SCSPTR, status); /* Set RTS = 1 */
+}
+
+static void sci_init_pins(struct uart_port *port, unsigned int cflag)
+{
+ struct sci_port *s = to_sci_port(port);
+ bool hwflow_enabled = cflag & CRTSCTS;
/*
* Use port-specific handler if provided.
@@ -522,22 +541,20 @@ static void sci_init_pins(struct uart_po
return;
}
- /*
- * For the generic path SCSPTR is necessary. Bail out if that's
- * unavailable, too.
+ /* SCIF hardware with RTS/CTS support needs special setup below.
+ *
+ * Please note that if RTS/CTS is available for the hardware
+ * platform depends on the particular SCIF channel on a certain
+ * SoC, and how this channel has been hooked up on the actual board.
+ *
+ * If the RTS/CTS signals will be used or not depends on what user
+ * space requests. In case RTS/CTS is available but not requested
+ * by user space we still need to configure the pins somehow.
*/
- if (!reg->size)
+ if (!(s->cfg->capabilities & SCIx_HAVE_RTSCTS))
return;
- if ((s->cfg->capabilities & SCIx_HAVE_RTSCTS) &&
- ((!(cflag & CRTSCTS)))) {
- unsigned short status;
-
- status = serial_port_in(port, SCSPTR);
- status &= ~SCSPTR_CTSIO;
- status |= SCSPTR_RTSIO;
- serial_port_out(port, SCSPTR, status); /* Set RTS = 1 */
- }
+ sci_init_ctsrts_default(port, hwflow_enabled);
}
static int sci_txfill(struct uart_port *port)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 02/05] serial: sh-sci: Fix default RTS handling
2015-03-19 1:49 [PATCH v2 00/05] serial: sh-sci: Hardware flow control update V2 Magnus Damm
2015-03-19 1:49 ` [PATCH v2 01/05] serial: sh-sci: Break out default CTS/RTS pin setup Magnus Damm
@ 2015-03-19 1:49 ` Magnus Damm
2015-03-19 1:50 ` [PATCH v2 03/05] serial: sh-sci: Expose default CTS pin Magnus Damm
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Magnus Damm @ 2015-03-19 1:49 UTC (permalink / raw)
To: linux-sh; +Cc: gregkh, geert, laurent.pinchart, linux-serial, Magnus Damm,
jslaby
From: Magnus Damm <damm+renesas@opensource.se>
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>
---
Changes since V1:
- When modem control is disabled, set RTS to zero to keep it asserted.
drivers/tty/serial/sh-sci.c | 7 +++++--
include/linux/serial_sci.h | 1 +
2 files changed, 6 insertions(+), 2 deletions(-)
--- 0002/drivers/tty/serial/sh-sci.c
+++ work/drivers/tty/serial/sh-sci.c 2015-03-19 09:13:03.186797991 +0900
@@ -522,10 +522,13 @@ static void sci_init_ctsrts_default(stru
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)
--- 0001/include/linux/serial_sci.h
+++ work/include/linux/serial_sci.h 2015-03-19 09:11:14.936798380 +0900
@@ -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 */
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 03/05] serial: sh-sci: Expose default CTS pin
2015-03-19 1:49 [PATCH v2 00/05] serial: sh-sci: Hardware flow control update V2 Magnus Damm
2015-03-19 1:49 ` [PATCH v2 01/05] serial: sh-sci: Break out default CTS/RTS pin setup Magnus Damm
2015-03-19 1:49 ` [PATCH v2 02/05] serial: sh-sci: Fix default RTS handling Magnus Damm
@ 2015-03-19 1:50 ` Magnus Damm
2015-03-19 1:50 ` [PATCH v2 04/05] serial: sh-sci: Add SCIFA/SCIFB CTS/RTS pin setup Magnus Damm
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Magnus Damm @ 2015-03-19 1:50 UTC (permalink / raw)
To: linux-sh; +Cc: gregkh, geert, laurent.pinchart, linux-serial, Magnus Damm,
jslaby
From: Magnus Damm <damm+renesas@opensource.se>
Expose the CTS pin to the ->get_mctrl() callback for the
default case. Without this patch the serial core can not
retrieve the CTS pin state from the SCIF driver.
Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---
Changes since V1:
- Return true to default to asserted state in case modem signals exist
drivers/tty/serial/sh-sci.c | 20 +++++++++++++++++++-
include/linux/serial_sci.h | 1 +
2 files changed, 20 insertions(+), 1 deletion(-)
--- 0003/drivers/tty/serial/sh-sci.c
+++ work/drivers/tty/serial/sh-sci.c 2015-03-19 09:17:37.856797004 +0900
@@ -509,6 +509,17 @@ static void sci_poll_put_char(struct uar
}
#endif /* CONFIG_CONSOLE_POLL || CONFIG_SERIAL_SH_SCI_CONSOLE */
+static bool sci_cts_asserted_default(struct uart_port *port)
+{
+ struct sci_port *s = to_sci_port(port);
+ struct plat_sci_reg *reg = sci_regmap[s->cfg->regtype] + SCSPTR;
+
+ if (reg->size)
+ return !(serial_port_in(port, SCSPTR) & SCSPTR_CTSDT);
+
+ return true;
+}
+
static void sci_init_ctsrts_default(struct uart_port *port, bool hwflow_enabled)
{
struct sci_port *s = to_sci_port(port);
@@ -1239,11 +1250,18 @@ static void sci_set_mctrl(struct uart_po
static unsigned int sci_get_mctrl(struct uart_port *port)
{
+ struct sci_port *s = to_sci_port(port);
+ bool cts_asserted = false;
+
/*
* CTS/RTS is handled in hardware when supported, while nothing
* else is wired up. Keep it simple and simply assert DSR/CAR.
*/
- return TIOCM_DSR | TIOCM_CAR;
+
+ if (s->cfg->capabilities & SCIx_HAVE_RTSCTS)
+ cts_asserted = sci_cts_asserted_default(port);
+
+ return TIOCM_DSR | TIOCM_CAR | (cts_asserted ? TIOCM_CTS : 0);
}
#ifdef CONFIG_SERIAL_SH_SCI_DMA
--- 0003/include/linux/serial_sci.h
+++ work/include/linux/serial_sci.h 2015-03-19 09:15:59.446797358 +0900
@@ -59,6 +59,7 @@
#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_CTSDT (1 << 4) /* Serial Port CTS Pin Data */
#define SCSPTR_SPB2IO (1 << 1) /* Serial Port Break Input/Output */
#define SCSPTR_SPB2DT (1 << 0) /* Serial Port Break Data */
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 04/05] serial: sh-sci: Add SCIFA/SCIFB CTS/RTS pin setup
2015-03-19 1:49 [PATCH v2 00/05] serial: sh-sci: Hardware flow control update V2 Magnus Damm
` (2 preceding siblings ...)
2015-03-19 1:50 ` [PATCH v2 03/05] serial: sh-sci: Expose default CTS pin Magnus Damm
@ 2015-03-19 1:50 ` Magnus Damm
2015-03-19 1:50 ` [PATCH v2 05/05] serial: sh-sci: Expose SCIFA/SCIFB CTS pin Magnus Damm
2015-03-19 15:57 ` [PATCH v2 00/05] serial: sh-sci: Hardware flow control update V2 Peter Hurley
5 siblings, 0 replies; 7+ messages in thread
From: Magnus Damm @ 2015-03-19 1:50 UTC (permalink / raw)
To: linux-sh; +Cc: gregkh, geert, laurent.pinchart, linux-serial, Magnus Damm,
jslaby
From: Magnus Damm <damm+renesas@opensource.se>
Add SCIFA/SCIFB pin setup code for CTS/RTS pins to handle
both cases of hardware flow control enabled or disabled.
Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---
Changes since V1:
- Adjusted function name to match with suggestion from Laurent
- Added bit definitions for SCPCR and SCPDR
- When modem control is disabled, set RTS to zero to keep it asserted.
drivers/tty/serial/sh-sci.c | 59 ++++++++++++++++++++++++++++++++++++++++++-
include/linux/serial_sci.h | 9 ++++++
2 files changed, 67 insertions(+), 1 deletion(-)
--- 0004/drivers/tty/serial/sh-sci.c
+++ work/drivers/tty/serial/sh-sci.c 2015-03-19 09:39:11.836792354 +0900
@@ -168,6 +168,8 @@ static struct plat_sci_reg sci_regmap[SC
[SCSPTR] = sci_reg_invalid,
[SCLSR] = sci_reg_invalid,
[HSSRR] = sci_reg_invalid,
+ [SCPCR] = sci_reg_invalid,
+ [SCPDR] = sci_reg_invalid,
},
/*
@@ -188,6 +190,8 @@ static struct plat_sci_reg sci_regmap[SC
[SCSPTR] = sci_reg_invalid,
[SCLSR] = sci_reg_invalid,
[HSSRR] = sci_reg_invalid,
+ [SCPCR] = sci_reg_invalid,
+ [SCPDR] = sci_reg_invalid,
},
/*
@@ -207,6 +211,8 @@ static struct plat_sci_reg sci_regmap[SC
[SCSPTR] = sci_reg_invalid,
[SCLSR] = sci_reg_invalid,
[HSSRR] = sci_reg_invalid,
+ [SCPCR] = { 0x30, 16 },
+ [SCPDR] = { 0x34, 16 },
},
/*
@@ -226,6 +232,8 @@ static struct plat_sci_reg sci_regmap[SC
[SCSPTR] = sci_reg_invalid,
[SCLSR] = sci_reg_invalid,
[HSSRR] = sci_reg_invalid,
+ [SCPCR] = { 0x30, 16 },
+ [SCPDR] = { 0x34, 16 },
},
/*
@@ -246,6 +254,8 @@ static struct plat_sci_reg sci_regmap[SC
[SCSPTR] = { 0x20, 16 },
[SCLSR] = { 0x24, 16 },
[HSSRR] = sci_reg_invalid,
+ [SCPCR] = sci_reg_invalid,
+ [SCPDR] = sci_reg_invalid,
},
/*
@@ -265,6 +275,8 @@ static struct plat_sci_reg sci_regmap[SC
[SCSPTR] = sci_reg_invalid,
[SCLSR] = sci_reg_invalid,
[HSSRR] = sci_reg_invalid,
+ [SCPCR] = sci_reg_invalid,
+ [SCPDR] = sci_reg_invalid,
},
/*
@@ -284,6 +296,8 @@ static struct plat_sci_reg sci_regmap[SC
[SCSPTR] = { 0x20, 16 },
[SCLSR] = { 0x24, 16 },
[HSSRR] = sci_reg_invalid,
+ [SCPCR] = sci_reg_invalid,
+ [SCPDR] = sci_reg_invalid,
},
/*
@@ -303,6 +317,8 @@ static struct plat_sci_reg sci_regmap[SC
[SCSPTR] = { 0x20, 16 },
[SCLSR] = { 0x24, 16 },
[HSSRR] = { 0x40, 16 },
+ [SCPCR] = sci_reg_invalid,
+ [SCPDR] = sci_reg_invalid,
},
/*
@@ -323,6 +339,8 @@ static struct plat_sci_reg sci_regmap[SC
[SCSPTR] = sci_reg_invalid,
[SCLSR] = { 0x24, 16 },
[HSSRR] = sci_reg_invalid,
+ [SCPCR] = sci_reg_invalid,
+ [SCPDR] = sci_reg_invalid,
},
/*
@@ -343,6 +361,8 @@ static struct plat_sci_reg sci_regmap[SC
[SCSPTR] = { 0x24, 16 },
[SCLSR] = { 0x28, 16 },
[HSSRR] = sci_reg_invalid,
+ [SCPCR] = sci_reg_invalid,
+ [SCPDR] = sci_reg_invalid,
},
/*
@@ -363,6 +383,8 @@ static struct plat_sci_reg sci_regmap[SC
[SCSPTR] = sci_reg_invalid,
[SCLSR] = sci_reg_invalid,
[HSSRR] = sci_reg_invalid,
+ [SCPCR] = sci_reg_invalid,
+ [SCPDR] = sci_reg_invalid,
},
};
@@ -542,6 +564,34 @@ static void sci_init_ctsrts_default(stru
serial_port_out(port, SCSPTR, status); /* Set RTS = 0 */
}
+static void sci_init_ctsrts_scifab(struct uart_port *port, bool hwflow_enabled)
+{
+ unsigned short control, data;
+
+ /* SCIFA/SCIFB CTS/RTS pin configuration depends on user space.
+ *
+ * In case of CTS - (SCPDR.CTSD is always accessible):
+ * - Hardware flow control enabled: "CTS pin function"
+ * - Hardware flow control disabled: "Input port"
+ *
+ * In case of RTS:
+ * - Hardware flow control enabled: "RTS pin function"
+ * - Hardware flow control disabled: "Output port" with value 0
+ */
+ control = serial_port_in(port, SCPCR);
+ data = serial_port_in(port, SCPDR);
+
+ if (hwflow_enabled) {
+ control &= ~(SCPCR_RTSC | SCPCR_CTSC);
+ } else {
+ control |= SCPCR_RTSC | SCPCR_CTSC;
+ data &= ~SCPDR_RTSD;
+ }
+
+ serial_port_out(port, SCPDR, data);
+ serial_port_out(port, SCPCR, control);
+}
+
static void sci_init_pins(struct uart_port *port, unsigned int cflag)
{
struct sci_port *s = to_sci_port(port);
@@ -568,7 +618,14 @@ static void sci_init_pins(struct uart_po
if (!(s->cfg->capabilities & SCIx_HAVE_RTSCTS))
return;
- sci_init_ctsrts_default(port, hwflow_enabled);
+ switch (s->cfg->type) {
+ case PORT_SCIFA:
+ case PORT_SCIFB:
+ sci_init_ctsrts_scifab(port, hwflow_enabled);
+ break;
+ default:
+ sci_init_ctsrts_default(port, hwflow_enabled);
+ }
}
static int sci_txfill(struct uart_port *port)
--- 0004/include/linux/serial_sci.h
+++ work/include/linux/serial_sci.h 2015-03-19 09:41:09.116791933 +0900
@@ -66,6 +66,13 @@
/* HSSRR HSCIF */
#define HSCIF_SRE 0x8000 /* Sampling Rate Register Enable */
+/* SCPCR (Serial Port Control Register) */
+#define SCPCR_RTSC (1 << 4) /* Serial Port RTS Pin / Output Pin */
+#define SCPCR_CTSC (1 << 3) /* Serial Port CTS Pin / Input Pin */
+
+/* SCPDR (Serial Port Data Register) */
+#define SCPDR_RTSD (1 << 4) /* Serial Port RTS Output Pin Data */
+
enum {
SCIx_PROBE_REGTYPE,
@@ -102,6 +109,8 @@ enum {
SCRFDR, /* Receive FIFO Data Count Register */
SCSPTR, /* Serial Port Register */
HSSRR, /* Sampling Rate Register */
+ SCPCR, /* Serial Port Control Register */
+ SCPDR, /* Serial Port Data Register */
SCIx_NR_REGS,
};
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 05/05] serial: sh-sci: Expose SCIFA/SCIFB CTS pin
2015-03-19 1:49 [PATCH v2 00/05] serial: sh-sci: Hardware flow control update V2 Magnus Damm
` (3 preceding siblings ...)
2015-03-19 1:50 ` [PATCH v2 04/05] serial: sh-sci: Add SCIFA/SCIFB CTS/RTS pin setup Magnus Damm
@ 2015-03-19 1:50 ` Magnus Damm
2015-03-19 15:57 ` [PATCH v2 00/05] serial: sh-sci: Hardware flow control update V2 Peter Hurley
5 siblings, 0 replies; 7+ messages in thread
From: Magnus Damm @ 2015-03-19 1:50 UTC (permalink / raw)
To: linux-sh; +Cc: gregkh, geert, laurent.pinchart, linux-serial, Magnus Damm,
jslaby
From: Magnus Damm <damm+renesas@opensource.se>
Expose CTS pin to serial core for the SCIFA/SCIFB case.
Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---
Changes since V1:
- Added bit definition for SCPDR_CTSD
drivers/tty/serial/sh-sci.c | 17 +++++++++++++++--
include/linux/serial_sci.h | 1 +
2 files changed, 16 insertions(+), 2 deletions(-)
--- 0005/drivers/tty/serial/sh-sci.c
+++ work/drivers/tty/serial/sh-sci.c 2015-03-19 09:57:43.266788360 +0900
@@ -564,6 +564,11 @@ static void sci_init_ctsrts_default(stru
serial_port_out(port, SCSPTR, status); /* Set RTS = 0 */
}
+static bool sci_cts_asserted_scifab(struct uart_port *port)
+{
+ return !(serial_port_in(port, SCPDR) & SCPDR_CTSD);
+}
+
static void sci_init_ctsrts_scifab(struct uart_port *port, bool hwflow_enabled)
{
unsigned short control, data;
@@ -1315,8 +1320,16 @@ static unsigned int sci_get_mctrl(struct
* else is wired up. Keep it simple and simply assert DSR/CAR.
*/
- if (s->cfg->capabilities & SCIx_HAVE_RTSCTS)
- cts_asserted = sci_cts_asserted_default(port);
+ if (s->cfg->capabilities & SCIx_HAVE_RTSCTS) {
+ switch (s->cfg->type) {
+ case PORT_SCIFA:
+ case PORT_SCIFB:
+ cts_asserted = sci_cts_asserted_scifab(port);
+ break;
+ default:
+ cts_asserted = sci_cts_asserted_default(port);
+ }
+ }
return TIOCM_DSR | TIOCM_CAR | (cts_asserted ? TIOCM_CTS : 0);
}
--- 0005/include/linux/serial_sci.h
+++ work/include/linux/serial_sci.h 2015-03-19 09:52:14.846789540 +0900
@@ -72,6 +72,7 @@
/* SCPDR (Serial Port Data Register) */
#define SCPDR_RTSD (1 << 4) /* Serial Port RTS Output Pin Data */
+#define SCPDR_CTSD (1 << 3) /* Serial Port CTS Input Pin Data */
enum {
SCIx_PROBE_REGTYPE,
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 00/05] serial: sh-sci: Hardware flow control update V2
2015-03-19 1:49 [PATCH v2 00/05] serial: sh-sci: Hardware flow control update V2 Magnus Damm
` (4 preceding siblings ...)
2015-03-19 1:50 ` [PATCH v2 05/05] serial: sh-sci: Expose SCIFA/SCIFB CTS pin Magnus Damm
@ 2015-03-19 15:57 ` Peter Hurley
5 siblings, 0 replies; 7+ messages in thread
From: Peter Hurley @ 2015-03-19 15:57 UTC (permalink / raw)
To: Magnus Damm
Cc: linux-sh, gregkh, geert, laurent.pinchart, linux-serial, jslaby
Hi Magnus,
On 03/18/2015 09:49 PM, Magnus Damm wrote:
> serial: sh-sci: Hardware flow control update V2
>
> [PATCH v2 01/05] serial: sh-sci: Break out default CTS/RTS pin setup
> [PATCH v2 02/05] serial: sh-sci: Fix default RTS handling
> [PATCH v2 03/05] serial: sh-sci: Expose default CTS pin
> [PATCH v2 04/05] serial: sh-sci: Add SCIFA/SCIFB CTS/RTS pin setup
> [PATCH v2 05/05] serial: sh-sci: Expose SCIFA/SCIFB CTS pin
>
> These patches are my latest take at improving CTS/RTS pin handling in
> the SCIF driver. The goal for these patches is to improve the default
> hardware flow control handling and also add CTS/RTS support for SCIFA/SCIFB.
The serial core expects RTS pin control to be implemented via the driver's
set_mctrl() method, and will take care of raising and lowering it when
necessary.
Regards,
Peter Hurley
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-03-19 15:57 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-19 1:49 [PATCH v2 00/05] serial: sh-sci: Hardware flow control update V2 Magnus Damm
2015-03-19 1:49 ` [PATCH v2 01/05] serial: sh-sci: Break out default CTS/RTS pin setup Magnus Damm
2015-03-19 1:49 ` [PATCH v2 02/05] serial: sh-sci: Fix default RTS handling Magnus Damm
2015-03-19 1:50 ` [PATCH v2 03/05] serial: sh-sci: Expose default CTS pin Magnus Damm
2015-03-19 1:50 ` [PATCH v2 04/05] serial: sh-sci: Add SCIFA/SCIFB CTS/RTS pin setup Magnus Damm
2015-03-19 1:50 ` [PATCH v2 05/05] serial: sh-sci: Expose SCIFA/SCIFB CTS pin Magnus Damm
2015-03-19 15:57 ` [PATCH v2 00/05] serial: sh-sci: Hardware flow control update V2 Peter Hurley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).