fdt_serial_gaisler.c 781 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * SPDX-License-Identifier: BSD-2-Clause
  3. *
  4. * Copyright (c) 2021 Cobham Gaisler AB.
  5. *
  6. * Authors:
  7. * Daniel Cederman <cederman@gaisler.com>
  8. */
  9. #include <sbi_utils/fdt/fdt_helper.h>
  10. #include <sbi_utils/serial/fdt_serial.h>
  11. #include <sbi_utils/serial/gaisler-uart.h>
  12. static int serial_gaisler_init(void *fdt, int nodeoff,
  13. const struct fdt_match *match)
  14. {
  15. int rc;
  16. struct platform_uart_data uart = { 0 };
  17. rc = fdt_parse_gaisler_uart_node(fdt, nodeoff, &uart);
  18. if (rc)
  19. return rc;
  20. return gaisler_uart_init(uart.addr, uart.freq, uart.baud);
  21. }
  22. static const struct fdt_match serial_gaisler_match[] = {
  23. { .compatible = "gaisler,apbuart" },
  24. {},
  25. };
  26. struct fdt_serial fdt_serial_gaisler = {
  27. .match_table = serial_gaisler_match,
  28. .init = serial_gaisler_init
  29. };