]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
atmel_serial: Use the fractional divider when possible
authorRomain Izard <romain.izard.pro@gmail.com>
Fri, 10 Feb 2017 15:24:46 +0000 (16:24 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Feb 2017 18:12:21 +0000 (10:12 -0800)
The fractional baud rate generator is available when using the
asynchronous mode of Atmel USART controllers. It makes it possible to
use higher baudrates, in exchange for a less precise clock with a
variable duty cycle.

The existing code restricts its use to the normal mode of the USART
controller, following the recommendation from the datasheet for the
first chip embedding this type of controller. This recommendation has
been removed from the documentation for the newer chips. After
verification, all revisions of this controller should be able to use the
fractional baud rate generator with the different asynchronous modes.

Removing the condition on ATMEL_US_USMODE makes it possible to get
correct baudrates at high speed in more cases.

This was tested with a board using an Atmel SAMA5D2 chip and a TI
WL1831 WiFi/Bluetooth combo chip at 3 Mbauds, with hardware flow control
enabled.

Signed-off-by: Romain Izard <romain.izard.pro@gmail.com>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/atmel_serial.c

index 8d2cec0f03c2575c7a204338a7824c3e4f3f74cb..dcebb28ffbc412d5282ef32b7f3c133ff984ab46 100644 (file)
@@ -1769,7 +1769,9 @@ static void atmel_get_ip_name(struct uart_port *port)
 
        /*
         * Only USART devices from at91sam9260 SOC implement fractional
-        * baudrate.
+        * baudrate. It is available for all asynchronous modes, with the
+        * following restriction: the sampling clock's duty cycle is not
+        * constant.
         */
        atmel_port->has_frac_baudrate = false;
        atmel_port->has_hw_timer = false;
@@ -2213,8 +2215,7 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios,
         * then
         * 8 CD + FP = selected clock / (2 * baudrate)
         */
-       if (atmel_port->has_frac_baudrate &&
-           (mode & ATMEL_US_USMODE) == ATMEL_US_USMODE_NORMAL) {
+       if (atmel_port->has_frac_baudrate) {
                div = DIV_ROUND_CLOSEST(port->uartclk, baud * 2);
                cd = div >> 3;
                fp = div & ATMEL_US_FP_MASK;