sysreset_xtfpga.c 720 B

123456789101112131415161718192021222324252627282930313233343536
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Cadence Tensilica xtfpga system reset driver.
  4. *
  5. * (C) Copyright 2016 Cadence Design Systems Inc.
  6. */
  7. #include <common.h>
  8. #include <dm.h>
  9. #include <errno.h>
  10. #include <sysreset.h>
  11. #include <asm/io.h>
  12. static int xtfpga_reset_request(struct udevice *dev, enum sysreset_t type)
  13. {
  14. switch (type) {
  15. case SYSRESET_COLD:
  16. writel(CONFIG_SYS_FPGAREG_RESET_CODE,
  17. CONFIG_SYS_FPGAREG_RESET);
  18. break;
  19. default:
  20. return -EPROTONOSUPPORT;
  21. }
  22. return -EINPROGRESS;
  23. }
  24. static struct sysreset_ops xtfpga_sysreset_ops = {
  25. .request = xtfpga_reset_request,
  26. };
  27. U_BOOT_DRIVER(xtfpga_sysreset) = {
  28. .name = "xtfpga_sysreset",
  29. .id = UCLASS_SYSRESET,
  30. .ops = &xtfpga_sysreset_ops,
  31. };