struct uart_port port;
struct work_struct tx_work;
struct work_struct md_work;
-
- struct serial_rs485 rs485;
};
struct sc16is7xx_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,
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))
uart_update_timeout(port, termios->c_cflag, baud);
}
-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);
- }
-}
-
-static int sc16is7xx_ioctl(struct uart_port *port, unsigned int cmd,
- unsigned long arg)
-{
- 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;
- }
-
- return -ENOIOCTLCMD;
+ return 0;
}
static int sc16is7xx_startup(struct uart_port *port)
.release_port = sc16is7xx_null_void,
.config_port = sc16is7xx_config_port,
.verify_port = sc16is7xx_verify_port,
- .ioctl = sc16is7xx_ioctl,
.pm = sc16is7xx_pm,
};
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);