sysreset_rk3288.c 980 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * (C) Copyright 2015 Google, Inc
  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_rk3288.h>
  13. #include <asm/arch/hardware.h>
  14. #include <linux/err.h>
  15. int rk3288_sysreset_request(struct udevice *dev, enum sysreset_t type)
  16. {
  17. struct rk3288_cru *cru = rockchip_get_cru();
  18. if (IS_ERR(cru))
  19. return PTR_ERR(cru);
  20. switch (type) {
  21. case SYSRESET_WARM:
  22. rk_clrreg(&cru->cru_mode_con, 0xffff);
  23. writel(0xeca8, &cru->cru_glb_srst_snd_value);
  24. break;
  25. case SYSRESET_COLD:
  26. rk_clrreg(&cru->cru_mode_con, 0xffff);
  27. writel(0xfdb9, &cru->cru_glb_srst_fst_value);
  28. break;
  29. default:
  30. return -EPROTONOSUPPORT;
  31. }
  32. return -EINPROGRESS;
  33. }
  34. static struct sysreset_ops rk3288_sysreset = {
  35. .request = rk3288_sysreset_request,
  36. };
  37. U_BOOT_DRIVER(sysreset_rk3288) = {
  38. .name = "rk3288_sysreset",
  39. .id = UCLASS_SYSRESET,
  40. .ops = &rk3288_sysreset,
  41. };