Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit faf02f8f authored by Paul Mundt's avatar Paul Mundt
Browse files

serial: sh-sci: per-port modem control.



The bulk of the ports do not support any sort of modem control, so
blindly twiddling the MCE bit doesn't accomplish much. We now require
ports to manually specify which line supports modem control signals.

While at it, tidy up the RTS/CTSIO handling in SCSPTR parts so it's a bit
more obvious what's going on (and without clobbering other configurations
in the process).

Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent dc7e3ef7
Loading
Loading
Loading
Loading
+20 −11
Original line number Original line Diff line number Diff line
@@ -474,8 +474,15 @@ static void sci_init_pins(struct uart_port *port, unsigned int cflag)
	if (!reg->size)
	if (!reg->size)
		return;
		return;


	if (!(cflag & CRTSCTS))
	if ((s->cfg->capabilities & SCIx_HAVE_RTSCTS) &&
		sci_out(port, SCSPTR, 0x0080); /* Set RTS = 1 */
	    ((!(cflag & CRTSCTS)))) {
		unsigned short status;

		status = sci_in(port, SCSPTR);
		status &= ~SCSPTR_CTSIO;
		status |= SCSPTR_RTSIO;
		sci_out(port, SCSPTR, status); /* Set RTS = 1 */
	}
}
}


static int sci_txfill(struct uart_port *port)
static int sci_txfill(struct uart_port *port)
@@ -1764,6 +1771,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,


	sci_init_pins(port, termios->c_cflag);
	sci_init_pins(port, termios->c_cflag);


	if (s->cfg->capabilities & SCIx_HAVE_RTSCTS) {
		reg = sci_getreg(port, SCFCR);
		reg = sci_getreg(port, SCFCR);
		if (reg->size) {
		if (reg->size) {
			unsigned short ctrl;
			unsigned short ctrl;
@@ -1775,6 +1783,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
				ctrl &= ~SCFCR_MCE;
				ctrl &= ~SCFCR_MCE;
			sci_out(port, SCFCR, ctrl);
			sci_out(port, SCFCR, ctrl);
		}
		}
	}


	sci_out(port, SCSCR, s->cfg->scscr);
	sci_out(port, SCSCR, s->cfg->scscr);


+10 −0
Original line number Original line Diff line number Diff line
@@ -49,6 +49,10 @@ enum {


#define SCIF_DEFAULT_ERROR_MASK (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK)
#define SCIF_DEFAULT_ERROR_MASK (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK)


/* SCSPTR, optional */
#define SCSPTR_RTSIO	(1 << 7)
#define SCSPTR_CTSIO	(1 << 5)

/* Offsets into the sci_port->irqs array */
/* Offsets into the sci_port->irqs array */
enum {
enum {
	SCIx_ERI_IRQ,
	SCIx_ERI_IRQ,
@@ -108,6 +112,11 @@ struct plat_sci_port_ops {
	void (*init_pins)(struct uart_port *, unsigned int cflag);
	void (*init_pins)(struct uart_port *, unsigned int cflag);
};
};


/*
 * Port-specific capabilities
 */
#define SCIx_HAVE_RTSCTS	(1 << 0)

/*
/*
 * Platform device specific platform_data struct
 * Platform device specific platform_data struct
 */
 */
@@ -116,6 +125,7 @@ struct plat_sci_port {
	unsigned int	irqs[SCIx_NR_IRQS];	/* ERI, RXI, TXI, BRI */
	unsigned int	irqs[SCIx_NR_IRQS];	/* ERI, RXI, TXI, BRI */
	unsigned int	type;			/* SCI / SCIF / IRDA */
	unsigned int	type;			/* SCI / SCIF / IRDA */
	upf_t		flags;			/* UPF_* flags */
	upf_t		flags;			/* UPF_* flags */
	unsigned long	capabilities;		/* Port features/capabilities */


	unsigned int	scbrr_algo_id;		/* SCBRR calculation algo */
	unsigned int	scbrr_algo_id;		/* SCBRR calculation algo */
	unsigned int	scscr;			/* SCSCR initialization */
	unsigned int	scscr;			/* SCSCR initialization */