sysreset_rv1108.c 953 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * (C) Copyright 2015 Rockchip Electronics Co., Ltd
  3. * Author: Andy Yan <andy.yan@rock-chips.com>
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <dm.h>
  8. #include <errno.h>
  9. #include <sysreset.h>
  10. #include <asm/io.h>
  11. #include <asm/arch/clock.h>
  12. #include <asm/arch/cru_rv1108.h>
  13. #include <asm/arch/hardware.h>
  14. #include <linux/err.h>
  15. int rv1108_sysreset_request(struct udevice *dev, enum sysreset_t type)
  16. {
  17. struct rv1108_cru *cru = rockchip_get_cru();
  18. if (IS_ERR(cru))
  19. return PTR_ERR(cru);
  20. switch (type) {
  21. case SYSRESET_WARM:
  22. writel(0xeca8, &cru->glb_srst_snd_val);
  23. break;
  24. case SYSRESET_COLD:
  25. writel(0xfdb9, &cru->glb_srst_fst_val);
  26. break;
  27. default:
  28. return -EPROTONOSUPPORT;
  29. }
  30. return -EINPROGRESS;
  31. }
  32. static struct sysreset_ops rv1108_sysreset = {
  33. .request = rv1108_sysreset_request,
  34. };
  35. U_BOOT_DRIVER(sysreset_rv1108) = {
  36. .name = "rv1108_sysreset",
  37. .id = UCLASS_SYSRESET,
  38. .ops = &rv1108_sysreset,
  39. };