soc_clock.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * Copyright (c) 2019 Actions Semiconductor Co., Ltd
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * @file peripheral clock configuration macros for Actions SoC
  8. */
  9. #ifndef _ACTIONS_SOC_CLOCK_H_
  10. #define _ACTIONS_SOC_CLOCK_H_
  11. #define CLOCK_ID_DMA 0
  12. #define CLOCK_ID_SD0 1
  13. #define CLOCK_ID_SD1 2
  14. #define CLOCK_ID_OTFD 3
  15. #define CLOCK_ID_SPI0 4
  16. #define CLOCK_ID_SPI1 5
  17. #define CLOCK_ID_SPI2 6
  18. #define CLOCK_ID_SPI3 7
  19. #define CLOCK_ID_SPI0CACHE 8
  20. #define CLOCK_ID_SPI1CACHE 9
  21. #define CLOCK_ID_USB 10
  22. #define CLOCK_ID_USB2 11 //USBHCLK
  23. #define CLOCK_ID_DE 12
  24. #define CLOCK_ID_JPEG 13 //JPEGCLK
  25. #define CLOCK_ID_LCD 14
  26. #define CLOCK_ID_GPU 15
  27. #define CLOCK_ID_SE 16
  28. #define CLOCK_ID_PWM0 17
  29. #define CLOCK_ID_AVS 18
  30. //#define CLOCK_ID_TIMER 18
  31. #define CLOCK_ID_LRADC 19
  32. #define CLOCK_ID_CPUTIMER 20
  33. #define CLOCK_ID_SDMA 21
  34. #define CLOCK_ID_I2C3 23
  35. #define CLOCK_ID_UART0 24
  36. #define CLOCK_ID_UART1 25
  37. #define CLOCK_ID_UART2 26
  38. #define CLOCK_ID_I2C0 27
  39. #define CLOCK_ID_I2C1 28
  40. #define CLOCK_ID_I2C2 29
  41. #define CLOCK_ID_EXINT 30
  42. #define CLOCK_ID_DSP 32
  43. #define CLOCK_ID_ASRC 33
  44. #define CLOCK_ID_AUDDSPTIMER 33
  45. #define CLOCK_ID_DAC 34
  46. #define CLOCK_ID_ADC 35
  47. #define CLOCK_ID_I2STX 36
  48. #define CLOCK_ID_I2SRX 37
  49. #define CLOCK_ID_I2SSRDCLK 38
  50. #define CLOCK_ID_I2SHCLKEN 39
  51. #define CLOCK_ID_DACANACLK (32 + 8)
  52. #define CLOCK_ID_TIMER0 (32 + 10)
  53. #define CLOCK_ID_TIMER1 (32 + 11)
  54. #define CLOCK_ID_TIMER2 (32 + 12)
  55. #define CLOCK_ID_TIMER3 (32 + 13)
  56. #define CLOCK_ID_TIMER4 (32 + 14)
  57. #define CLOCK_ID_TIMER5 (32 + 15)
  58. #define CLOCK_ID_SPIMT0 48
  59. #define CLOCK_ID_SPIMT1 49
  60. #define CLOCK_ID_I2CMT0 50
  61. #define CLOCK_ID_I2CMT1 51
  62. #define CLOCK_ID_PWM1 (32 + 20)
  63. #define CLOCK_ID_PWM2 (32 + 21)
  64. #define CLOCK_ID_PWM3 (32 + 22)
  65. #define CLOCK_ID_MAX_ID 63
  66. #ifndef _ASMLANGUAGE
  67. void acts_clock_peripheral_enable(int clock_id);
  68. void acts_clock_peripheral_disable(int clock_id);
  69. uint32_t clk_rate_get_corepll(void);
  70. int clk_set_rate(int clock_id, uint32_t rate_hz);
  71. uint32_t clk_get_rate(int clock_id);
  72. uint32_t clk_ahb_set(uint32_t div);
  73. uint32_t soc_freq_get_dsp_freq(void);
  74. uint32_t soc_freq_get_cpu_freq(void);
  75. void soc_freq_set_cpu_clk(uint32_t dsp_mhz, uint32_t cpu_mhz);
  76. void soc_freq_set_gpu_clk(uint32_t gpu_mhz, uint32_t de_mhz, uint32_t jpeg_mhz);
  77. uint32_t soc_freq_calculate(uint8_t divisor, uint8_t clk_src);
  78. uint8_t soc_freq_divisor_calculate(uint32_t freq_mhz, uint32_t max_mhz);
  79. #endif /* _ASMLANGUAGE */
  80. #endif /* _ACTIONS_SOC_CLOCK_H_ */