soc.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * Copyright (c) 2019, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef __SOC_H__
  7. #define __SOC_H__
  8. #include <plat_private.h>
  9. #ifndef BITS_WMSK
  10. #define BITS_WMSK(msk, shift) ((msk) << (shift + REG_MSK_SHIFT))
  11. #endif
  12. enum plls_id {
  13. APLL_ID = 0,
  14. DPLL_ID,
  15. CPLL_ID,
  16. NPLL_ID,
  17. GPLL_ID,
  18. END_PLL_ID,
  19. };
  20. enum pll_mode {
  21. SLOW_MODE,
  22. NORM_MODE,
  23. DEEP_SLOW_MODE,
  24. };
  25. /***************************************************************************
  26. * GRF
  27. ***************************************************************************/
  28. #define GRF_SOC_CON(i) (0x0400 + (i) * 4)
  29. #define GRF_PD_VO_CON0 0x0434
  30. #define GRF_SOC_STATUS0 0x0480
  31. #define GRF_CPU_STATUS0 0x0520
  32. #define GRF_CPU_STATUS1 0x0524
  33. #define GRF_SOC_NOC_CON0 0x0530
  34. #define GRF_SOC_NOC_CON1 0x0534
  35. #define CKECK_WFE_MSK 0x1
  36. #define CKECK_WFI_MSK 0x10
  37. #define CKECK_WFEI_MSK 0x11
  38. #define GRF_SOC_CON2_NSWDT_RST_EN 12
  39. /***************************************************************************
  40. * cru
  41. ***************************************************************************/
  42. #define CRU_MODE 0xa0
  43. #define CRU_MISC 0xa4
  44. #define CRU_GLB_CNT_TH 0xb0
  45. #define CRU_GLB_RST_ST 0xb4
  46. #define CRU_GLB_SRST_FST 0xb8
  47. #define CRU_GLB_SRST_SND 0xbc
  48. #define CRU_GLB_RST_CON 0xc0
  49. #define CRU_CLKSEL_CON 0x100
  50. #define CRU_CLKSELS_CON(i) (CRU_CLKSEL_CON + (i) * 4)
  51. #define CRU_CLKSEL_CON_CNT 60
  52. #define CRU_CLKGATE_CON 0x200
  53. #define CRU_CLKGATES_CON(i) (CRU_CLKGATE_CON + (i) * 4)
  54. #define CRU_CLKGATES_CON_CNT 18
  55. #define CRU_SOFTRST_CON 0x300
  56. #define CRU_SOFTRSTS_CON(n) (CRU_SOFTRST_CON + ((n) * 4))
  57. #define CRU_SOFTRSTS_CON_CNT 12
  58. #define CRU_AUTOCS_CON0(id) (0x400 + (id) * 8)
  59. #define CRU_AUTOCS_CON1(id) (0x404 + (id) * 8)
  60. #define CRU_CONS_GATEID(i) (16 * (i))
  61. #define GATE_ID(reg, bit) ((reg) * 16 + (bit))
  62. #define CRU_GLB_SRST_FST_VALUE 0xfdb9
  63. #define CRU_GLB_SRST_SND_VALUE 0xeca8
  64. #define CRU_GLB_RST_TSADC_EXT 6
  65. #define CRU_GLB_RST_WDT_EXT 7
  66. #define CRU_GLB_CNT_RST_MSK 0xffff
  67. #define CRU_GLB_CNT_RST_1MS 0x5DC0
  68. #define CRU_GLB_RST_TSADC_FST BIT(0)
  69. #define CRU_GLB_RST_WDT_FST BIT(1)
  70. /***************************************************************************
  71. * pll
  72. ***************************************************************************/
  73. #define CRU_PLL_CONS(id, i) ((id) * 0x20 + (i) * 4)
  74. #define PLL_CON(i) ((i) * 4)
  75. #define PLL_CON_CNT 5
  76. #define PLL_LOCK_MSK BIT(10)
  77. #define PLL_MODE_SHIFT(id) ((id) == CPLL_ID ? \
  78. 2 : \
  79. ((id) == DPLL_ID ? 4 : 2 * (id)))
  80. #define PLL_MODE_MSK(id) (0x3 << PLL_MODE_SHIFT(id))
  81. #define PLL_LOCKED_TIMEOUT 600000U
  82. /***************************************************************************
  83. * GPIO
  84. ***************************************************************************/
  85. #define SWPORTA_DR 0x00
  86. #define SWPORTA_DDR 0x04
  87. #define GPIO_INTEN 0x30
  88. #define GPIO_INT_STATUS 0x40
  89. #define GPIO_NUMS 4
  90. void clk_gate_con_save(uint32_t *clkgt_save);
  91. void clk_gate_con_restore(uint32_t *clkgt_save);
  92. void clk_gate_con_disable(void);
  93. void px30_soc_reset_config(void);
  94. #endif /* __SOC_H__ */