Skip to contentSkip to conversation

sh73a0 KZM9G CTS/RTS prototype

PATCH New Magnus Damm 1 participant 1 message Mar 19, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh73a0 KZM9G CTS/RTS prototype

From: Magnus Damm <[email protected]>

This is a hack that enables console serial port hardware flow control for the KZM9G board. Not for upstream merge.

Not-Yet-Signed-off-by Magnus Damm <[email protected]>

---

 arch/arm/boot/dts/sh73a0-kzm9g.dts |    1 +
 drivers/tty/serial/sh-sci.c        |   12 ++++++++++++
 2 files changed, 13 insertions(+)
arch/arm/boot/dts/sh73a0-kzm9g.dts +1 -0
@@ -370,6 +370,7 @@
 	pinctrl-0 = <&scifa4_pins>;
 	pinctrl-names = "default";
 
+	ctsrts;
 	status = "okay";
 };
 
drivers/tty/serial/sh-sci.c +12 -0
@@ -573,6 +573,9 @@ static void sci_init_ctsrts_scifab(struc
 {
 	unsigned short control, data;
 
+	printk("xxx SCIFAB hw flow control: %s\n",
+	       hwflow_enabled ? "on" : "off");
+
 	/* SCIFA/SCIFB CTS/RTS pin configuration depends on user space.
 	 *
 	 * In case of CTS - (SCPDR.CTSD is always accessible):
@@ -2048,6 +2051,9 @@ static void sci_set_termios(struct uart_
 	} else
 		serial_port_out(port, SCSMR, smr_val);
 
+	/* hard code modem control enablement for now */
+	termios->c_cflag |= CRTSCTS;
+
 	sci_init_pins(port, termios->c_cflag);
 
 	reg = sci_getreg(port, SCFCR);
@@ -2055,6 +2061,10 @@ static void sci_set_termios(struct uart_
 		unsigned short ctrl = serial_port_in(port, SCFCR);
 
 		if (s->cfg->capabilities & SCIx_HAVE_RTSCTS) {
+
+		  printk("xxx enabling hw flow control: %s\n",
+			 (termios->c_cflag & CRTSCTS) ? "on" : "off");
+
 			if (termios->c_cflag & CRTSCTS)
 				ctrl |= SCFCR_MCE;
 			else
@@ -2640,6 +2650,8 @@ sci_parse_dt(struct platform_device *pde
 	p->type = info->type;
 	p->regtype = info->regtype;
 	p->scscr = SCSCR_RE | SCSCR_TE;
+	if (of_property_read_bool(np, "ctsrts"))
+		p->capabilities = SCIx_HAVE_RTSCTS;
 
 	return p;
 }