From: Magnus Damm <magnus.damm@gmail.com>
To: linux-sh@vger.kernel.org
Cc: gregkh@linuxfoundation.org, Magnus Damm <magnus.damm@gmail.com>,
jslaby@suse.cz, linux-serial@vger.kernel.org
Subject: [PATCH 01/05] serial: sh-sci: Break out default CTS/RTS pin setup
Date: Wed, 17 Dec 2014 12:52:46 +0000 [thread overview]
Message-ID: <20141217125246.14480.41876.sendpatchset@w520> (raw)
In-Reply-To: <20141217125236.14480.78833.sendpatchset@w520>
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>
---
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 2014-12-16 14:40:31.000000000 +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_pins_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_pins_default(port, hwflow_enabled);
}
static int sci_txfill(struct uart_port *port)
WARNING: multiple messages have this Message-ID (diff)
From: Magnus Damm <magnus.damm@gmail.com>
To: linux-sh@vger.kernel.org
Cc: gregkh@linuxfoundation.org, Magnus Damm <magnus.damm@gmail.com>,
jslaby@suse.cz, linux-serial@vger.kernel.org
Subject: [PATCH 01/05] serial: sh-sci: Break out default CTS/RTS pin setup
Date: Wed, 17 Dec 2014 21:52:46 +0900 [thread overview]
Message-ID: <20141217125246.14480.41876.sendpatchset@w520> (raw)
In-Reply-To: <20141217125236.14480.78833.sendpatchset@w520>
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>
---
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 2014-12-16 14:40:31.000000000 +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_pins_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_pins_default(port, hwflow_enabled);
}
static int sci_txfill(struct uart_port *port)
next prev parent reply other threads:[~2014-12-17 12:52 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-17 12:52 [PATCH 00/05] serial: sh-sci: Hardware flow control update Magnus Damm
2014-12-17 12:52 ` Magnus Damm
2014-12-17 12:52 ` Magnus Damm [this message]
2014-12-17 12:52 ` [PATCH 01/05] serial: sh-sci: Break out default CTS/RTS pin setup Magnus Damm
2015-01-05 8:25 ` Laurent Pinchart
2015-01-05 8:25 ` Laurent Pinchart
2015-03-19 2:16 ` Magnus Damm
2015-03-19 2:16 ` Magnus Damm
2014-12-17 12:52 ` [PATCH 02/05] serial: sh-sci: Fix default RTS handling Magnus Damm
2014-12-17 12:52 ` Magnus Damm
2014-12-17 12:53 ` [PATCH 03/05] serial: sh-sci: Expose default CTS pin Magnus Damm
2014-12-17 12:53 ` Magnus Damm
2014-12-17 12:53 ` [PATCH 04/05] serial: sh-sci: Add SCIFA/SCIFB CTS/RTS pin setup Magnus Damm
2014-12-17 12:53 ` Magnus Damm
2015-01-05 7:46 ` Laurent Pinchart
2015-01-05 7:46 ` Laurent Pinchart
2015-03-19 2:20 ` Magnus Damm
2015-03-19 2:20 ` Magnus Damm
2014-12-17 12:53 ` [PATCH 05/05] serial: sh-sci: Expose SCIFA/SCIFB CTS pin Magnus Damm
2014-12-17 12:53 ` Magnus Damm
2015-01-05 7:53 ` Laurent Pinchart
2015-01-05 7:53 ` Laurent Pinchart
2015-03-19 2:18 ` Magnus Damm
2015-03-19 2:18 ` Magnus Damm
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=20141217125246.14480.41876.sendpatchset@w520 \
--to=magnus.damm@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.