Hi, On 11/04/2017 22:12, Rodolfo Giometti wrote: > This patch adds multidrop support for atmel serial controllers and it > has been tested by using a SAMA5D3 CPU. > > Signed-off-by: Rodolfo Giometti <giometti@xxxxxxxx> > --- > drivers/tty/serial/atmel_serial.c | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > > diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c > index 81a3a0a..111eeec 100644 > --- a/drivers/tty/serial/atmel_serial.c > +++ b/drivers/tty/serial/atmel_serial.c > @@ -2038,7 +2038,7 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, > { > struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); > unsigned long flags; > - unsigned int old_mode, mode, imr, quot, baud, div, cd, fp = 0; > + unsigned int old_mode, mode, mdrop, imr, quot, baud, div, cd, fp = 0; I think it will be clearer if mdrop variable is not used (cf bellow) > /* save the current mode register */ > mode = old_mode = atmel_uart_readl(port, ATMEL_US_MR); > @@ -2071,9 +2071,11 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, > > /* parity */ > if (termios->c_cflag & PARENB) { > - /* Mark or Space parity */ > + /* Mark, Space or Multidrop parity */ > if (termios->c_cflag & CMSPAR) { > - if (termios->c_cflag & PARODD) > + if (termios->c_cflag & PARMD) > + mode |= ATMEL_US_PAR_MULTI_DROP; > + else if (termios->c_cflag & PARODD) > mode |= ATMEL_US_PAR_MARK; > else > mode |= ATMEL_US_PAR_SPACE; > @@ -2081,8 +2083,11 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, > mode |= ATMEL_US_PAR_ODD; > else > mode |= ATMEL_US_PAR_EVEN; > + Please don't add new lines where they are not needed. > } else > mode |= ATMEL_US_PAR_NONE; > + mdrop = termios->c_cflag & SENDA ? ATMEL_US_SENDA : 0; > + termios->c_cflag &= ~SENDA; /* SENDA bit must be cleared once used */ > > spin_lock_irqsave(&port->lock, flags); > > @@ -2211,7 +2216,8 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, > > atmel_uart_writel(port, ATMEL_US_BRGR, quot); > atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_RSTSTA | ATMEL_US_RSTRX); > - atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXEN | ATMEL_US_RXEN); > + atmel_uart_writel(port, ATMEL_US_CR, > + mdrop | ATMEL_US_TXEN | ATMEL_US_RXEN); If SENDA is tested and reseted here: if (termios->c_cflag & SENDA) { /* SENDA bit must be cleared once used */ termios->c_cflag &= ~SENDA; atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_SENDA); } There's no need for a mdrop variable anymore, and the code is IHMO simpler. > /* restore interrupts */ > atmel_uart_writel(port, ATMEL_US_IER, imr); > Regards, Richard. -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html