sysreset_xtfpga.c 727 B

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