diff mbox

[05/05] serial: sh-sci: Expose SCIFA/SCIFB CTS pin

Message ID 20141217125325.14480.79285.sendpatchset@w520 (mailing list archive)
State Changes Requested
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Magnus Damm Dec. 17, 2014, 12:53 p.m. UTC
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>
---

 drivers/tty/serial/sh-sci.c |   17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Laurent Pinchart Jan. 5, 2015, 7:53 a.m. UTC | #1
Hi Magnus,

Thank you for the patch.

On Wednesday 17 December 2014 21:53:25 Magnus Damm wrote:
> 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>
> ---
> 
>  drivers/tty/serial/sh-sci.c |   17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
> --- 0023/drivers/tty/serial/sh-sci.c
> +++ work/drivers/tty/serial/sh-sci.c	2014-12-17 18:46:44.000000000 +0900
> @@ -564,6 +564,11 @@ static void sci_init_pins_default(struct
>  	serial_port_out(port, SCSPTR, status); /* Set RTS = 1 */
>  }
> 
> +static bool sci_cts_asserted_scifab(struct uart_port *port)
> +{
> +	return !(serial_port_in(port, SCPDR) & BIT(3));

Could you please define SCPDR_CTSD to replace BIT(3) ?

> +}
> +
>  static void sci_init_pins_scifab(struct uart_port *port, bool
> hwflow_enabled) {
>  	unsigned short control, data;
> @@ -1304,8 +1309,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);
>  }
Magnus Damm March 19, 2015, 2:18 a.m. UTC | #2
Hi Laurent,

On Sun, Jan 4, 2015 at 11:53 PM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> Hi Magnus,
>
> Thank you for the patch.
>
> On Wednesday 17 December 2014 21:53:25 Magnus Damm wrote:
>> 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>
>> ---
>>
>>  drivers/tty/serial/sh-sci.c |   17 +++++++++++++++--
>>  1 file changed, 15 insertions(+), 2 deletions(-)
>>
>> --- 0023/drivers/tty/serial/sh-sci.c
>> +++ work/drivers/tty/serial/sh-sci.c  2014-12-17 18:46:44.000000000 +0900
>> @@ -564,6 +564,11 @@ static void sci_init_pins_default(struct
>>       serial_port_out(port, SCSPTR, status); /* Set RTS = 1 */
>>  }
>>
>> +static bool sci_cts_asserted_scifab(struct uart_port *port)
>> +{
>> +     return !(serial_port_in(port, SCPDR) & BIT(3));
>
> Could you please define SCPDR_CTSD to replace BIT(3) ?

Done in V2!

Thanks,

/ magnus
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- 0023/drivers/tty/serial/sh-sci.c
+++ work/drivers/tty/serial/sh-sci.c	2014-12-17 18:46:44.000000000 +0900
@@ -564,6 +564,11 @@  static void sci_init_pins_default(struct
 	serial_port_out(port, SCSPTR, status); /* Set RTS = 1 */
 }
 
+static bool sci_cts_asserted_scifab(struct uart_port *port)
+{
+	return !(serial_port_in(port, SCPDR) & BIT(3));
+}
+
 static void sci_init_pins_scifab(struct uart_port *port, bool hwflow_enabled)
 {
 	unsigned short control, data;
@@ -1304,8 +1309,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);
 }