summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/sc16is7xx.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-12-14 15:23:32 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-14 15:23:32 -0800
commit37da7bbbe84fe9e8862940d3f9194fd27dce59bb (patch)
tree6c3fae910b4cfd4e2f9a1fdc035400cd4df78be3 /drivers/tty/serial/sc16is7xx.c
parente7cf773d431a63a2417902696fcc9e0ebdc83bbe (diff)
parentdd63af108f0814f0b589659f4e55a7a5af3b7e53 (diff)
downloadlinux-rpi3-37da7bbbe84fe9e8862940d3f9194fd27dce59bb.tar.gz
linux-rpi3-37da7bbbe84fe9e8862940d3f9194fd27dce59bb.tar.bz2
linux-rpi3-37da7bbbe84fe9e8862940d3f9194fd27dce59bb.zip
Merge tag 'tty-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty/serial driver updates from Greg KH: "Here's the big tty/serial driver update for 3.19-rc1. There are a number of TTY core changes/fixes in here from Peter Hurley that have all been teted in linux-next for a long time now. There are also the normal serial driver updates as well, full details in the changelog below" * tag 'tty-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (219 commits) serial: pxa: hold port.lock when reporting modem line changes tty-hvsi_lib: Deletion of an unnecessary check before the function call "tty_kref_put" tty: Deletion of unnecessary checks before two function calls n_tty: Fix read_buf race condition, increment read_head after pushing data serial: of-serial: add PM suspend/resume support Revert "serial: of-serial: add PM suspend/resume support" Revert "serial: of-serial: fix up PM ops on no_console_suspend and port type" serial: 8250: don't attempt a trylock if in sysrq serial: core: Add big-endian iotype serial: samsung: use port->fifosize instead of hardcoded values serial: samsung: prefer to use fifosize from driver data serial: samsung: fix style problems serial: samsung: wait for transfer completion before clock disable serial: icom: fix error return code serial: tegra: clean up tty-flag assignments serial: Fix io address assign flow with Fintek PCI-to-UART Product serial: mxs-auart: fix tx_empty against shift register serial: mxs-auart: fix gpio change detection on interrupt serial: mxs-auart: Fix mxs_auart_set_ldisc() serial: 8250_dw: Use 64-bit access for OCTEON. ...
Diffstat (limited to 'drivers/tty/serial/sc16is7xx.c')
-rw-r--r--drivers/tty/serial/sc16is7xx.c57
1 files changed, 12 insertions, 45 deletions
diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index 6246820d7f05..df9a384dfbda 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -304,8 +304,6 @@ struct sc16is7xx_one {
struct uart_port port;
struct work_struct tx_work;
struct work_struct md_work;
-
- struct serial_rs485 rs485;
};
struct sc16is7xx_port {
@@ -657,15 +655,15 @@ static void sc16is7xx_stop_tx(struct uart_port* port)
struct circ_buf *xmit = &one->port.state->xmit;
/* handle rs485 */
- if (one->rs485.flags & SER_RS485_ENABLED) {
+ if (port->rs485.flags & SER_RS485_ENABLED) {
/* do nothing if current tx not yet completed */
int lsr = sc16is7xx_port_read(port, SC16IS7XX_LSR_REG);
if (!(lsr & SC16IS7XX_LSR_TEMT_BIT))
return;
if (uart_circ_empty(xmit) &&
- (one->rs485.delay_rts_after_send > 0))
- mdelay(one->rs485.delay_rts_after_send);
+ (port->rs485.delay_rts_after_send > 0))
+ mdelay(port->rs485.delay_rts_after_send);
}
sc16is7xx_port_update(port, SC16IS7XX_IER_REG,
@@ -688,9 +686,9 @@ static void sc16is7xx_start_tx(struct uart_port *port)
struct sc16is7xx_one *one = to_sc16is7xx_one(port, port);
/* handle rs485 */
- if ((one->rs485.flags & SER_RS485_ENABLED) &&
- (one->rs485.delay_rts_before_send > 0)) {
- mdelay(one->rs485.delay_rts_before_send);
+ if ((port->rs485.flags & SER_RS485_ENABLED) &&
+ (port->rs485.delay_rts_before_send > 0)) {
+ mdelay(port->rs485.delay_rts_before_send);
}
if (!work_pending(&one->tx_work))
@@ -830,51 +828,20 @@ static void sc16is7xx_set_termios(struct uart_port *port,
uart_update_timeout(port, termios->c_cflag, baud);
}
-#if defined(TIOCSRS485) && defined(TIOCGRS485)
-static void sc16is7xx_config_rs485(struct uart_port *port,
+static int sc16is7xx_config_rs485(struct uart_port *port,
struct serial_rs485 *rs485)
{
- struct sc16is7xx_one *one = to_sc16is7xx_one(port, port);
-
- one->rs485 = *rs485;
-
- if (one->rs485.flags & SER_RS485_ENABLED) {
+ if (port->rs485.flags & SER_RS485_ENABLED)
sc16is7xx_port_update(port, SC16IS7XX_EFCR_REG,
SC16IS7XX_EFCR_AUTO_RS485_BIT,
SC16IS7XX_EFCR_AUTO_RS485_BIT);
- } else {
+ else
sc16is7xx_port_update(port, SC16IS7XX_EFCR_REG,
SC16IS7XX_EFCR_AUTO_RS485_BIT,
0);
- }
-}
-#endif
-
-static int sc16is7xx_ioctl(struct uart_port *port, unsigned int cmd,
- unsigned long arg)
-{
-#if defined(TIOCSRS485) && defined(TIOCGRS485)
- struct serial_rs485 rs485;
+ port->rs485 = *rs485;
- switch (cmd) {
- case TIOCSRS485:
- if (copy_from_user(&rs485, (void __user *)arg, sizeof(rs485)))
- return -EFAULT;
-
- sc16is7xx_config_rs485(port, &rs485);
- return 0;
- case TIOCGRS485:
- if (copy_to_user((void __user *)arg,
- &(to_sc16is7xx_one(port, port)->rs485),
- sizeof(rs485)))
- return -EFAULT;
- return 0;
- default:
- break;
- }
-#endif
-
- return -ENOIOCTLCMD;
+ return 0;
}
static int sc16is7xx_startup(struct uart_port *port)
@@ -1000,7 +967,6 @@ static const struct uart_ops sc16is7xx_ops = {
.release_port = sc16is7xx_null_void,
.config_port = sc16is7xx_config_port,
.verify_port = sc16is7xx_verify_port,
- .ioctl = sc16is7xx_ioctl,
.pm = sc16is7xx_pm,
};
@@ -1130,6 +1096,7 @@ static int sc16is7xx_probe(struct device *dev,
s->p[i].port.flags = UPF_FIXED_TYPE | UPF_LOW_LATENCY;
s->p[i].port.iotype = UPIO_PORT;
s->p[i].port.uartclk = freq;
+ s->p[i].port.rs485_config = sc16is7xx_config_rs485;
s->p[i].port.ops = &sc16is7xx_ops;
/* Disable all interrupts */
sc16is7xx_port_write(&s->p[i].port, SC16IS7XX_IER_REG, 0);