diff options
-rw-r--r-- | drivers/tty/serial/sh-sci.c | 31 | ||||
-rw-r--r-- | include/linux/serial_sci.h | 10 |
2 files changed, 30 insertions, 11 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 46deaaec836d..fd60d72eac89 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c | |||
@@ -474,8 +474,15 @@ static void sci_init_pins(struct uart_port *port, unsigned int cflag) | |||
474 | if (!reg->size) | 474 | if (!reg->size) |
475 | return; | 475 | return; |
476 | 476 | ||
477 | if (!(cflag & CRTSCTS)) | 477 | if ((s->cfg->capabilities & SCIx_HAVE_RTSCTS) && |
478 | sci_out(port, SCSPTR, 0x0080); /* Set RTS = 1 */ | 478 | ((!(cflag & CRTSCTS)))) { |
479 | unsigned short status; | ||
480 | |||
481 | status = sci_in(port, SCSPTR); | ||
482 | status &= ~SCSPTR_CTSIO; | ||
483 | status |= SCSPTR_RTSIO; | ||
484 | sci_out(port, SCSPTR, status); /* Set RTS = 1 */ | ||
485 | } | ||
479 | } | 486 | } |
480 | 487 | ||
481 | static int sci_txfill(struct uart_port *port) | 488 | static int sci_txfill(struct uart_port *port) |
@@ -1764,16 +1771,18 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1764 | 1771 | ||
1765 | sci_init_pins(port, termios->c_cflag); | 1772 | sci_init_pins(port, termios->c_cflag); |
1766 | 1773 | ||
1767 | reg = sci_getreg(port, SCFCR); | 1774 | if (s->cfg->capabilities & SCIx_HAVE_RTSCTS) { |
1768 | if (reg->size) { | 1775 | reg = sci_getreg(port, SCFCR); |
1769 | unsigned short ctrl; | 1776 | if (reg->size) { |
1777 | unsigned short ctrl; | ||
1770 | 1778 | ||
1771 | ctrl = sci_in(port, SCFCR); | 1779 | ctrl = sci_in(port, SCFCR); |
1772 | if (termios->c_cflag & CRTSCTS) | 1780 | if (termios->c_cflag & CRTSCTS) |
1773 | ctrl |= SCFCR_MCE; | 1781 | ctrl |= SCFCR_MCE; |
1774 | else | 1782 | else |
1775 | ctrl &= ~SCFCR_MCE; | 1783 | ctrl &= ~SCFCR_MCE; |
1776 | sci_out(port, SCFCR, ctrl); | 1784 | sci_out(port, SCFCR, ctrl); |
1785 | } | ||
1777 | } | 1786 | } |
1778 | 1787 | ||
1779 | sci_out(port, SCSCR, s->cfg->scscr); | 1788 | sci_out(port, SCSCR, s->cfg->scscr); |
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h index 369273a52679..15b1bdcaa9f5 100644 --- a/include/linux/serial_sci.h +++ b/include/linux/serial_sci.h | |||
@@ -49,6 +49,10 @@ enum { | |||
49 | 49 | ||
50 | #define SCIF_DEFAULT_ERROR_MASK (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK) | 50 | #define SCIF_DEFAULT_ERROR_MASK (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK) |
51 | 51 | ||
52 | /* SCSPTR, optional */ | ||
53 | #define SCSPTR_RTSIO (1 << 7) | ||
54 | #define SCSPTR_CTSIO (1 << 5) | ||
55 | |||
52 | /* Offsets into the sci_port->irqs array */ | 56 | /* Offsets into the sci_port->irqs array */ |
53 | enum { | 57 | enum { |
54 | SCIx_ERI_IRQ, | 58 | SCIx_ERI_IRQ, |
@@ -109,6 +113,11 @@ struct plat_sci_port_ops { | |||
109 | }; | 113 | }; |
110 | 114 | ||
111 | /* | 115 | /* |
116 | * Port-specific capabilities | ||
117 | */ | ||
118 | #define SCIx_HAVE_RTSCTS (1 << 0) | ||
119 | |||
120 | /* | ||
112 | * Platform device specific platform_data struct | 121 | * Platform device specific platform_data struct |
113 | */ | 122 | */ |
114 | struct plat_sci_port { | 123 | struct plat_sci_port { |
@@ -116,6 +125,7 @@ struct plat_sci_port { | |||
116 | unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */ | 125 | unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */ |
117 | unsigned int type; /* SCI / SCIF / IRDA */ | 126 | unsigned int type; /* SCI / SCIF / IRDA */ |
118 | upf_t flags; /* UPF_* flags */ | 127 | upf_t flags; /* UPF_* flags */ |
128 | unsigned long capabilities; /* Port features/capabilities */ | ||
119 | 129 | ||
120 | unsigned int scbrr_algo_id; /* SCBRR calculation algo */ | 130 | unsigned int scbrr_algo_id; /* SCBRR calculation algo */ |
121 | unsigned int scscr; /* SCSCR initialization */ | 131 | unsigned int scscr; /* SCSCR initialization */ |