Re: [PATCHv2 2/2] serial: Add driver for the Altera UART

From: Alan Cox
Date: Mon Mar 01 2010 - 13:16:08 EST


> + * Some boards implement the DTR/DCD lines using GPIO lines, most don't. Dummy
> + * out the access macros for those that don't. Those that do should define these
> + * macros somewhere in their board specific inlude files.
> + */
> +#if !defined(altera_uart_getppdcd)
> +# define altera_uart_getppdcd(p) (1)
> +#endif
> +#if !defined(altera_uart_getppdtr)
> +# define altera_uart_getppdtr(p) (1)
> +#endif
> +#if !defined(altera_uart_setppdtr)
> +# define altera_uart_setppdtr(p, v) do { } while (0)
> +#endif

Those ought to be in the board stuff only - the problem you have
otherwise is that someone not noticing won't get an error.


> +static void altera_uart_set_termios(struct uart_port *port,
> + struct ktermios *termios,
> + struct ktermios *old)
> +{
> + unsigned long flags;
> + unsigned int baud, baudclk;
> +
> + baud = uart_get_baud_rate(port, termios, old, 0, 4000000);
> + baudclk = port->uartclk / baud;
> +
> + spin_lock_irqsave(&port->lock, flags);
> + writel(baudclk, port->membase + ALTERA_UART_DIVISOR_REG);
> + spin_unlock_irqrestore(&port->lock, flags);

If you only support board setting then copy the old termios back as in
the other driver and the use tty_termios_encode_baud_rate() to report
set the baud rate accordingly.

Acked-by: Alan Cox <alan@xxxxxxxxxxxxxxx>

As the oddments that want adjusting can be done post merge and I'd rather
see this in now than later as there are some serial_core changes cooking
that will need to touch all drivers.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/