exynos-cpufreq.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Copyright (c) 2010 Samsung Electronics Co., Ltd.
  3. * http://www.samsung.com
  4. *
  5. * EXYNOS - CPUFreq support
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. enum cpufreq_level_index {
  12. L0, L1, L2, L3, L4,
  13. L5, L6, L7, L8, L9,
  14. L10, L11, L12, L13, L14,
  15. L15, L16, L17, L18, L19,
  16. L20,
  17. };
  18. #define APLL_FREQ(f, a0, a1, a2, a3, a4, a5, a6, a7, b0, b1, b2, m, p, s) \
  19. { \
  20. .freq = (f) * 1000, \
  21. .clk_div_cpu0 = ((a0) | (a1) << 4 | (a2) << 8 | (a3) << 12 | \
  22. (a4) << 16 | (a5) << 20 | (a6) << 24 | (a7) << 28), \
  23. .clk_div_cpu1 = (b0 << 0 | b1 << 4 | b2 << 8), \
  24. .mps = ((m) << 16 | (p) << 8 | (s)), \
  25. }
  26. struct apll_freq {
  27. unsigned int freq;
  28. u32 clk_div_cpu0;
  29. u32 clk_div_cpu1;
  30. u32 mps;
  31. };
  32. struct exynos_dvfs_info {
  33. unsigned long mpll_freq_khz;
  34. unsigned int pll_safe_idx;
  35. struct clk *cpu_clk;
  36. unsigned int *volt_table;
  37. struct cpufreq_frequency_table *freq_table;
  38. void (*set_freq)(unsigned int, unsigned int);
  39. bool (*need_apll_change)(unsigned int, unsigned int);
  40. };
  41. #ifdef CONFIG_ARM_EXYNOS4210_CPUFREQ
  42. extern int exynos4210_cpufreq_init(struct exynos_dvfs_info *);
  43. #else
  44. static inline int exynos4210_cpufreq_init(struct exynos_dvfs_info *info)
  45. {
  46. return -EOPNOTSUPP;
  47. }
  48. #endif
  49. #ifdef CONFIG_ARM_EXYNOS4X12_CPUFREQ
  50. extern int exynos4x12_cpufreq_init(struct exynos_dvfs_info *);
  51. #else
  52. static inline int exynos4x12_cpufreq_init(struct exynos_dvfs_info *info)
  53. {
  54. return -EOPNOTSUPP;
  55. }
  56. #endif
  57. #ifdef CONFIG_ARM_EXYNOS5250_CPUFREQ
  58. extern int exynos5250_cpufreq_init(struct exynos_dvfs_info *);
  59. #else
  60. static inline int exynos5250_cpufreq_init(struct exynos_dvfs_info *info)
  61. {
  62. return -EOPNOTSUPP;
  63. }
  64. #endif
  65. #include <plat/cpu.h>
  66. #include <mach/map.h>
  67. #define EXYNOS4_CLKSRC_CPU (S5P_VA_CMU + 0x14200)
  68. #define EXYNOS4_CLKMUX_STATCPU (S5P_VA_CMU + 0x14400)
  69. #define EXYNOS4_CLKDIV_CPU (S5P_VA_CMU + 0x14500)
  70. #define EXYNOS4_CLKDIV_CPU1 (S5P_VA_CMU + 0x14504)
  71. #define EXYNOS4_CLKDIV_STATCPU (S5P_VA_CMU + 0x14600)
  72. #define EXYNOS4_CLKDIV_STATCPU1 (S5P_VA_CMU + 0x14604)
  73. #define EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT (16)
  74. #define EXYNOS4_CLKMUX_STATCPU_MUXCORE_MASK (0x7 << EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT)
  75. #define EXYNOS5_APLL_LOCK (S5P_VA_CMU + 0x00000)
  76. #define EXYNOS5_APLL_CON0 (S5P_VA_CMU + 0x00100)
  77. #define EXYNOS5_CLKMUX_STATCPU (S5P_VA_CMU + 0x00400)
  78. #define EXYNOS5_CLKDIV_CPU0 (S5P_VA_CMU + 0x00500)
  79. #define EXYNOS5_CLKDIV_CPU1 (S5P_VA_CMU + 0x00504)
  80. #define EXYNOS5_CLKDIV_STATCPU0 (S5P_VA_CMU + 0x00600)
  81. #define EXYNOS5_CLKDIV_STATCPU1 (S5P_VA_CMU + 0x00604)