s10_clock_manager.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * Copyright (c) 2019-2023, Intel Corporation. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef __CLOCKMANAGER_H__
  7. #define __CLOCKMANAGER_H__
  8. #include "s10_system_manager.h"
  9. #include "socfpga_handoff.h"
  10. #define ALT_CLKMGR 0xffd10000
  11. #define ALT_CLKMGR_CTRL 0x0
  12. #define ALT_CLKMGR_STAT 0x4
  13. #define ALT_CLKMGR_INTRCLR 0x14
  14. #define ALT_CLKMGR_INTRCLR_MAINLOCKLOST_SET_MSK 0x00000004
  15. #define ALT_CLKMGR_INTRCLR_PERLOCKLOST_SET_MSK 0x00000008
  16. #define ALT_CLKMGR_CTRL_BOOTMODE_SET_MSK 0x00000001
  17. #define ALT_CLKMGR_STAT_BUSY_E_BUSY 0x1
  18. #define ALT_CLKMGR_STAT_BUSY(x) (((x) & 0x00000001) >> 0)
  19. #define ALT_CLKMGR_STAT_MAINPLLLOCKED(x) (((x) & 0x00000100) >> 8)
  20. #define ALT_CLKMGR_STAT_PERPLLLOCKED(x) (((x) & 0x00000200) >> 9)
  21. #define ALT_CLKMGR_MAINPLL 0xffd10030
  22. #define ALT_CLKMGR_MAINPLL_EN 0x0
  23. #define ALT_CLKMGR_MAINPLL_BYPASS 0xc
  24. #define ALT_CLKMGR_MAINPLL_MPUCLK 0x18
  25. #define ALT_CLKMGR_MAINPLL_NOCCLK 0x1c
  26. #define ALT_CLKMGR_MAINPLL_CNTR2CLK 0x20
  27. #define ALT_CLKMGR_MAINPLL_CNTR3CLK 0x24
  28. #define ALT_CLKMGR_MAINPLL_CNTR4CLK 0x28
  29. #define ALT_CLKMGR_MAINPLL_CNTR5CLK 0x2c
  30. #define ALT_CLKMGR_MAINPLL_CNTR6CLK 0x30
  31. #define ALT_CLKMGR_MAINPLL_CNTR7CLK 0x34
  32. #define ALT_CLKMGR_MAINPLL_CNTR8CLK 0x38
  33. #define ALT_CLKMGR_MAINPLL_CNTR9CLK 0x3c
  34. #define ALT_CLKMGR_MAINPLL_NOCDIV 0x40
  35. #define ALT_CLKMGR_MAINPLL_PLLGLOB 0x44
  36. #define ALT_CLKMGR_MAINPLL_FDBCK 0x48
  37. #define ALT_CLKMGR_MAINPLL_PLLC0 0x54
  38. #define ALT_CLKMGR_MAINPLL_PLLC1 0x58
  39. #define ALT_CLKMGR_MAINPLL_VCOCALIB 0x5c
  40. #define ALT_CLKMGR_MAINPLL_EN_RESET 0x000000ff
  41. #define ALT_CLKMGR_MAINPLL_FDBCK_MDIV(x) (((x) & 0xff000000) >> 24)
  42. #define ALT_CLKMGR_MAINPLL_PLLGLOB_PD_SET_MSK 0x00000001
  43. #define ALT_CLKMGR_MAINPLL_PLLGLOB_REFCLKDIV(x) (((x) & 0x00003f00) >> 8)
  44. #define ALT_CLKMGR_MAINPLL_PLLGLOB_RST_SET_MSK 0x00000002
  45. #define ALT_CLKMGR_MAINPLL_VCOCALIB_HSCNT_SET(x) (((x) << 0) & 0x000000ff)
  46. #define ALT_CLKMGR_MAINPLL_VCOCALIB_MSCNT_SET(x) (((x) << 9) & 0x0001fe00)
  47. #define ALT_CLKMGR_PSRC(x) (((x) & 0x00030000) >> 16)
  48. #define ALT_CLKMGR_SRC_MAIN 0
  49. #define ALT_CLKMGR_SRC_PER 1
  50. #define ALT_CLKMGR_PLLGLOB_PSRC_EOSC1 0x0
  51. #define ALT_CLKMGR_PLLGLOB_PSRC_INTOSC 0x1
  52. #define ALT_CLKMGR_PLLGLOB_PSRC_F2S 0x2
  53. #define ALT_CLKMGR_PERPLL 0xffd100a4
  54. #define ALT_CLKMGR_PERPLL_EN 0x0
  55. #define ALT_CLKMGR_PERPLL_EN_SDMMCCLK BIT(5)
  56. #define ALT_CLKMGR_PERPLL_BYPASS 0xc
  57. #define ALT_CLKMGR_PERPLL_CNTR2CLK 0x18
  58. #define ALT_CLKMGR_PERPLL_CNTR3CLK 0x1c
  59. #define ALT_CLKMGR_PERPLL_CNTR4CLK 0x20
  60. #define ALT_CLKMGR_PERPLL_CNTR5CLK 0x24
  61. #define ALT_CLKMGR_PERPLL_CNTR6CLK 0x28
  62. #define ALT_CLKMGR_PERPLL_CNTR7CLK 0x2c
  63. #define ALT_CLKMGR_PERPLL_CNTR8CLK 0x30
  64. #define ALT_CLKMGR_PERPLL_CNTR9CLK 0x34
  65. #define ALT_CLKMGR_PERPLL_GPIODIV 0x3c
  66. #define ALT_CLKMGR_PERPLL_EMACCTL 0x38
  67. #define ALT_CLKMGR_PERPLL_PLLGLOB 0x40
  68. #define ALT_CLKMGR_PERPLL_FDBCK 0x44
  69. #define ALT_CLKMGR_PERPLL_PLLC0 0x50
  70. #define ALT_CLKMGR_PERPLL_PLLC1 0x54
  71. #define ALT_CLKMGR_PERPLL_EN_RESET 0x00000fff
  72. #define ALT_CLKMGR_PERPLL_FDBCK_MDIV(x) (((x) & 0xff000000) >> 24)
  73. #define ALT_CLKMGR_PERPLL_GPIODIV_GPIODBCLK_SET(x) (((x) << 0) & 0x0000ffff)
  74. #define ALT_CLKMGR_PERPLL_PLLGLOB_PD_SET_MSK 0x00000001
  75. #define ALT_CLKMGR_PERPLL_PLLGLOB_REFCLKDIV(x) (((x) & 0x00003f00) >> 8)
  76. #define ALT_CLKMGR_PERPLL_PLLGLOB_REFCLKDIV_SET(x) (((x) << 8) & 0x00003f00)
  77. #define ALT_CLKMGR_PERPLL_PLLGLOB_RST_SET_MSK 0x00000002
  78. #define ALT_CLKMGR_PERPLL_VCOCALIB_HSCNT_SET(x) (((x) << 0) & 0x000000ff)
  79. #define ALT_CLKMGR_PERPLL_VCOCALIB_MSCNT_SET(x) (((x) << 9) & 0x0001fe00)
  80. #define ALT_CLKMGR_PERPLL_VCOCALIB 0x58
  81. #define ALT_CLKMGR_INTOSC_HZ 460000000
  82. void config_clkmgr_handoff(handoff *hoff_ptr);
  83. uint32_t get_wdt_clk(void);
  84. uint32_t get_uart_clk(void);
  85. uint32_t get_mmc_clk(void);
  86. uint32_t get_l3_clk(uint32_t ref_clk);
  87. uint32_t get_cpu_clk(void);
  88. uint32_t get_ref_clk(uint32_t pllglob);
  89. uint32_t get_mpu_periph_clk(void);
  90. #endif