pmic.c 792 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) 2019, MediaTek Inc. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <pmic_wrap_init.h>
  7. #include <pmic.h>
  8. void bcpu_enable(uint32_t en)
  9. {
  10. pwrap_write(PMIC_VPROC11_OP_EN, 0x1);
  11. if (en)
  12. pwrap_write(PMIC_VPROC11_CON0, 1);
  13. else
  14. pwrap_write(PMIC_VPROC11_CON0, 0);
  15. }
  16. void bcpu_sram_enable(uint32_t en)
  17. {
  18. pwrap_write(PMIC_VSRAM_PROC11_OP_EN, 0x1);
  19. if (en)
  20. pwrap_write(PMIC_VSRAM_PROC11_CON0, 1);
  21. else
  22. pwrap_write(PMIC_VSRAM_PROC11_CON0, 0);
  23. }
  24. void wk_pmic_enable_sdn_delay(void)
  25. {
  26. uint32_t con;
  27. pwrap_write(PMIC_TMA_KEY, 0x9CA7);
  28. pwrap_read(PMIC_PSEQ_ELR11, &con);
  29. con &= ~PMIC_RG_SDN_DLY_ENB;
  30. pwrap_write(PMIC_PSEQ_ELR11, con);
  31. pwrap_write(PMIC_TMA_KEY, 0);
  32. }
  33. void pmic_power_off(void)
  34. {
  35. pwrap_write(PMIC_PWRHOLD, 0x0);
  36. }