sysreset.c 902 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
  4. *
  5. * Reset driver for tangier processor
  6. */
  7. #include <common.h>
  8. #include <dm.h>
  9. #include <sysreset.h>
  10. #include <asm/scu.h>
  11. static int tangier_sysreset_request(struct udevice *dev, enum sysreset_t type)
  12. {
  13. int value;
  14. switch (type) {
  15. case SYSRESET_WARM:
  16. value = IPCMSG_WARM_RESET;
  17. break;
  18. case SYSRESET_COLD:
  19. value = IPCMSG_COLD_RESET;
  20. break;
  21. default:
  22. return -ENOSYS;
  23. }
  24. scu_ipc_simple_command(value, 0);
  25. return -EINPROGRESS;
  26. }
  27. static const struct udevice_id tangier_sysreset_ids[] = {
  28. { .compatible = "intel,reset-tangier" },
  29. { }
  30. };
  31. static struct sysreset_ops tangier_sysreset_ops = {
  32. .request = tangier_sysreset_request,
  33. };
  34. U_BOOT_DRIVER(tangier_sysreset) = {
  35. .name = "tangier-sysreset",
  36. .id = UCLASS_SYSRESET,
  37. .of_match = tangier_sysreset_ids,
  38. .ops = &tangier_sysreset_ops,
  39. };