fdt_serial_shakti.c 728 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * SPDX-License-Identifier: BSD-2-Clause
  3. *
  4. * Copyright (c) 2020 Vijai Kumar K <vijai@behindbytes.com>
  5. *
  6. */
  7. #include <sbi_utils/fdt/fdt_helper.h>
  8. #include <sbi_utils/serial/fdt_serial.h>
  9. #include <sbi_utils/serial/shakti-uart.h>
  10. static int serial_shakti_init(void *fdt, int nodeoff,
  11. const struct fdt_match *match)
  12. {
  13. int rc;
  14. struct platform_uart_data uart = { 0 };
  15. rc = fdt_parse_shakti_uart_node(fdt, nodeoff, &uart);
  16. if (rc)
  17. return rc;
  18. return shakti_uart_init(uart.addr, uart.freq, uart.baud);
  19. }
  20. static const struct fdt_match serial_shakti_match[] = {
  21. { .compatible = "shakti,uart0" },
  22. { },
  23. };
  24. struct fdt_serial fdt_serial_shakti = {
  25. .match_table = serial_shakti_match,
  26. .init = serial_shakti_init
  27. };