sysreset_rk3036.c 921 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * (C) Copyright 2015 Rockchip Electronics Co., Ltd
  3. *
  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_rk3036.h>
  13. #include <asm/arch/hardware.h>
  14. #include <linux/err.h>
  15. int rk3036_sysreset_request(struct udevice *dev, enum sysreset_t type)
  16. {
  17. struct rk3036_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->cru_glb_srst_snd_value);
  23. break;
  24. case SYSRESET_COLD:
  25. writel(0xfdb9, &cru->cru_glb_srst_fst_value);
  26. break;
  27. default:
  28. return -EPROTONOSUPPORT;
  29. }
  30. return -EINPROGRESS;
  31. }
  32. static struct sysreset_ops rk3036_sysreset = {
  33. .request = rk3036_sysreset_request,
  34. };
  35. U_BOOT_DRIVER(sysreset_rk3036) = {
  36. .name = "rk3036_sysreset",
  37. .id = UCLASS_SYSRESET,
  38. .ops = &rk3036_sysreset,
  39. };