fdt_serial_sifive.c 831 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * SPDX-License-Identifier: BSD-2-Clause
  3. *
  4. * Copyright (c) 2020 Western Digital Corporation or its affiliates.
  5. *
  6. * Authors:
  7. * Anup Patel <anup.patel@wdc.com>
  8. */
  9. #include <sbi_utils/fdt/fdt_helper.h>
  10. #include <sbi_utils/serial/fdt_serial.h>
  11. #include <sbi_utils/serial/sifive-uart.h>
  12. static int serial_sifive_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_sifive_uart_node(fdt, nodeoff, &uart);
  18. if (rc)
  19. return rc;
  20. return sifive_uart_init(uart.addr, uart.freq, uart.baud);
  21. }
  22. static const struct fdt_match serial_sifive_match[] = {
  23. { .compatible = "sifive,fu540-c000-uart" },
  24. { .compatible = "sifive,uart0" },
  25. { },
  26. };
  27. struct fdt_serial fdt_serial_sifive = {
  28. .match_table = serial_sifive_match,
  29. .init = serial_sifive_init
  30. };