tty: serial: atmel: Make the driver aware of the existence of GCLK
authorSergiu Moga <sergiu.moga@microchip.com>
Thu, 22 Sep 2022 11:33:46 +0000 (14:33 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Sep 2022 14:31:56 +0000 (16:31 +0200)
commit5e3ce1f261296bfe4bb59a98c82f4959d214a4f7
treec829d9baaa09245ebc95b6990adb9e40a591d5b3
parent5644bf1843d915b6fb460fd44f4b9f9ac19a3fbb
tty: serial: atmel: Make the driver aware of the existence of GCLK

Previously, the atmel serial driver did not take into account the
possibility of using the more customizable generic clock as its
baudrate generator. Unless there is a Fractional Part available to
increase accuracy, there is a high chance that we may be able to
generate a baudrate closer to the desired one by using the GCLK as the
clock source. Now, depending on the error rate between
the desired baudrate and the actual baudrate, the serial driver will
fallback on the generic clock. The generic clock must be provided
in the DT node of the serial that may need a more flexible clock source.

Furthermore, define the bit that represents the choice of having GCLK
as a baudrate source clock inside the USCLKS bitmask of the Mode Register
of USART IP's.

Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
Link: https://lore.kernel.org/r/20220922113347.144383-9-sergiu.moga@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/atmel_serial.c
drivers/tty/serial/atmel_serial.h