mbox series

[0/5] Make atmel serial driver aware of GCLK

Message ID 20220817075517.49575-1-sergiu.moga@microchip.com
Headers show
Series Make atmel serial driver aware of GCLK | expand

Message

Sergiu Moga Aug. 17, 2022, 7:55 a.m. UTC
This series of patches introduces the GCLK as a potential clock source for
the baudrate generator of UART on sama5d2 SoCs. Unlike the serial mode of
the USART offered by FLEXCOM, the UART does not provide a fractional part
that can be added to the clock divisor to obtain a more accurate result,
which greatly decreases the flexibility available for producing a higher
variety of baudrates. Now, with the last patch of the series, the driver
will check for a GCLK in the DT. If provided, whenever `atmel_set_termios`
is called, unless there is a fractional part, the driver will compare the
error rate between the desired baudrate and the actual baudrate obtained
through each of the available clock sources and will choose the clock source
with the lowest error rate. While at it, convert the DT binding
for UART/USART to json-schema, update the FLEXCOM binding to reference the
new UART/USART binding and differentiate between the SPI of USART and the
SPI of FLEXCOM.

The first three patches of this patch series depend on this patch series
converting atmel-flexcom bindings to json-schema:
https://lore.kernel.org/all/20220708115619.254073-1-kavyasree.kotagiri@microchip.com/

Sergiu Moga (5):
  dt-bindings: mfd: atmel,sama5d2-flexcom: Add SPI child node ref
    binding
  dt-bindings: mfd: atmel,at91-usart: convert to json-schema
  dt-bindings: mfd: atmel,sama5d2-flexcom: Add USART child node ref
    binding
  clk: at91: sama5d2: Add Generic Clocks for UART/USART
  tty: serial: atmel: Make the driver aware of the existence of GCLK

 .../bindings/mfd/atmel,at91-usart.yaml        | 190 ++++++++++++++++++
 .../bindings/mfd/atmel,sama5d2-flexcom.yaml   |  18 +-
 .../devicetree/bindings/mfd/atmel-usart.txt   |  98 ---------
 drivers/clk/at91/sama5d2.c                    |  10 +
 drivers/tty/serial/atmel_serial.c             |  52 ++++-
 drivers/tty/serial/atmel_serial.h             |   1 +
 6 files changed, 264 insertions(+), 105 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
 delete mode 100644 Documentation/devicetree/bindings/mfd/atmel-usart.txt

Comments

Krzysztof Kozlowski Aug. 18, 2022, 8:31 a.m. UTC | #1
On 17/08/2022 10:55, Sergiu Moga wrote:
> Another functionality of FLEXCOM is that of SPI. In order for
> the proper validation of the SPI children nodes through the binding
> to occur, the proper binding for SPI must be referenced.
> 
> Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
> ---
>  .../devicetree/bindings/mfd/atmel,sama5d2-flexcom.yaml       | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/mfd/atmel,sama5d2-flexcom.yaml b/Documentation/devicetree/bindings/mfd/atmel,sama5d2-flexcom.yaml
> index 568da7cb630c..e158af47c326 100644
> --- a/Documentation/devicetree/bindings/mfd/atmel,sama5d2-flexcom.yaml
> +++ b/Documentation/devicetree/bindings/mfd/atmel,sama5d2-flexcom.yaml
> @@ -78,10 +78,9 @@ patternProperties:
>        of USART bindings.
>  
>    "^spi@[0-9a-f]+$":
> -    type: object
> +    $ref: ../spi/atmel,at91rm9200-spi.yaml

Full schemas path, so:

/schemas/spi/atmel....


Best regards,
Krzysztof