From: Magnus Damm <magnus.damm@gmail.com>
To: linux-sh@vger.kernel.org
Cc: gregkh@linuxfoundation.org, geert@glider.be,
laurent.pinchart@ideasonboard.com, linux-serial@vger.kernel.org,
Magnus Damm <magnus.damm@gmail.com>,
jslaby@suse.cz
Subject: [PATCH v2 05/05] serial: sh-sci: Expose SCIFA/SCIFB CTS pin
Date: Thu, 19 Mar 2015 01:50:23 +0000 [thread overview]
Message-ID: <20150319015023.14235.86850.sendpatchset@little-apple> (raw)
In-Reply-To: <20150319014933.14235.44835.sendpatchset@little-apple>
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,
next prev parent reply other threads:[~2015-03-19 1:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Magnus Damm [this message]
2015-03-19 15:57 ` [PATCH v2 00/05] serial: sh-sci: Hardware flow control update V2 Peter Hurley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150319015023.14235.86850.sendpatchset@little-apple \
--to=magnus.damm@gmail.com \
--cc=geert@glider.be \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-serial@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox