struct uart_port port;
unsigned int sigs; /* Local copy of line sigs */
unsigned char imr; /* Local IMR mirror */
- struct serial_rs485 rs485; /* RS485 settings */
};
/****************************************************************************/
{
struct mcf_uart *pp = container_of(port, struct mcf_uart, port);
- if (pp->rs485.flags & SER_RS485_ENABLED) {
+ if (port->rs485.flags & SER_RS485_ENABLED) {
/* Enable Transmitter */
writeb(MCFUART_UCR_TXENABLE, port->membase + MCFUART_UCR);
/* Manually assert RTS */
mr2 |= MCFUART_MR2_TXCTS;
}
- if (pp->rs485.flags & SER_RS485_ENABLED) {
+ if (port->rs485.flags & SER_RS485_ENABLED) {
dev_dbg(port->dev, "Setting UART to RS485\n");
mr2 |= MCFUART_MR2_TXRTS;
}
pp->imr &= ~MCFUART_UIR_TXREADY;
writeb(pp->imr, port->membase + MCFUART_UIMR);
/* Disable TX to negate RTS automatically */
- if (pp->rs485.flags & SER_RS485_ENABLED)
+ if (port->rs485.flags & SER_RS485_ENABLED)
writeb(MCFUART_UCR_TXDISABLE,
port->membase + MCFUART_UCR);
}
/****************************************************************************/
/* Enable or disable the RS485 support */
-static void mcf_config_rs485(struct uart_port *port, struct serial_rs485 *rs485)
+static int mcf_config_rs485(struct uart_port *port, struct serial_rs485 *rs485)
{
struct mcf_uart *pp = container_of(port, struct mcf_uart, port);
unsigned long flags;
}
writeb(mr1, port->membase + MCFUART_UMR);
writeb(mr2, port->membase + MCFUART_UMR);
- pp->rs485 = *rs485;
+ port->rs485 = *rs485;
spin_unlock_irqrestore(&port->lock, flags);
-}
-static int mcf_ioctl(struct uart_port *port, unsigned int cmd,
- unsigned long arg)
-{
- switch (cmd) {
- case TIOCSRS485: {
- struct serial_rs485 rs485;
- if (copy_from_user(&rs485, (struct serial_rs485 *)arg,
- sizeof(struct serial_rs485)))
- return -EFAULT;
- mcf_config_rs485(port, &rs485);
- break;
- }
- case TIOCGRS485: {
- struct mcf_uart *pp = container_of(port, struct mcf_uart, port);
- if (copy_to_user((struct serial_rs485 *)arg, &pp->rs485,
- sizeof(struct serial_rs485)))
- return -EFAULT;
- break;
- }
- default:
- return -ENOIOCTLCMD;
- }
return 0;
}
.release_port = mcf_release_port,
.config_port = mcf_config_port,
.verify_port = mcf_verify_port,
- .ioctl = mcf_ioctl,
};
static struct mcf_uart mcf_ports[4];
port->irq = platp[i].irq;
port->uartclk = MCF_BUSCLK;
port->flags = UPF_BOOT_AUTOCONF;
+ port->rs485_config = mcf_config_rs485;
port->ops = &mcf_uart_ops;
}
port->uartclk = MCF_BUSCLK;
port->ops = &mcf_uart_ops;
port->flags = UPF_BOOT_AUTOCONF;
+ port->rs485_config = mcf_config_rs485;
uart_add_one_port(&mcf_driver, port);
}