fdt_ipi_plicsw.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * SPDX-License-Identifier: BSD-2-Clause
  3. *
  4. * Copyright (c) 2022 Andes Technology Corporation
  5. *
  6. * Authors:
  7. * Zong Li <zong@andestech.com>
  8. * Nylon Chen <nylon7@andestech.com>
  9. * Leo Yu-Chi Liang <ycliang@andestech.com>
  10. * Yu Chien Peter Lin <peterlin@andestech.com>
  11. */
  12. #include <sbi/riscv_io.h>
  13. #include <sbi_utils/fdt/fdt_helper.h>
  14. #include <sbi_utils/ipi/fdt_ipi.h>
  15. #include <sbi_utils/ipi/andes_plicsw.h>
  16. extern struct plicsw_data plicsw;
  17. int fdt_plicsw_cold_ipi_init(void *fdt, int nodeoff,
  18. const struct fdt_match *match)
  19. {
  20. int rc;
  21. rc = fdt_parse_plicsw_node(fdt, nodeoff, &plicsw.addr, &plicsw.size,
  22. &plicsw.hart_count);
  23. if (rc)
  24. return rc;
  25. rc = plicsw_cold_ipi_init(&plicsw);
  26. if (rc)
  27. return rc;
  28. return 0;
  29. }
  30. static const struct fdt_match ipi_plicsw_match[] = {
  31. { .compatible = "andestech,plicsw" },
  32. {},
  33. };
  34. struct fdt_ipi fdt_ipi_plicsw = {
  35. .match_table = ipi_plicsw_match,
  36. .cold_init = fdt_plicsw_cold_ipi_init,
  37. .warm_init = plicsw_warm_ipi_init,
  38. .exit = NULL,
  39. };