exynos-cpufreq.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. enum exynos_soc_type {
  19. EXYNOS_SOC_4210,
  20. EXYNOS_SOC_4212,
  21. EXYNOS_SOC_4412,
  22. EXYNOS_SOC_5250,
  23. };
  24. #define APLL_FREQ(f, a0, a1, a2, a3, a4, a5, a6, a7, b0, b1, b2, m, p, s) \
  25. { \
  26. .freq = (f) * 1000, \
  27. .clk_div_cpu0 = ((a0) | (a1) << 4 | (a2) << 8 | (a3) << 12 | \
  28. (a4) << 16 | (a5) << 20 | (a6) << 24 | (a7) << 28), \
  29. .clk_div_cpu1 = (b0 << 0 | b1 << 4 | b2 << 8), \
  30. .mps = ((m) << 16 | (p) << 8 | (s)), \
  31. }
  32. struct apll_freq {
  33. unsigned int freq;
  34. u32 clk_div_cpu0;
  35. u32 clk_div_cpu1;
  36. u32 mps;
  37. };
  38. struct exynos_dvfs_info {
  39. enum exynos_soc_type type;
  40. struct device *dev;
  41. unsigned long mpll_freq_khz;
  42. unsigned int pll_safe_idx;
  43. struct clk *cpu_clk;
  44. unsigned int *volt_table;
  45. struct cpufreq_frequency_table *freq_table;
  46. void (*set_freq)(unsigned int, unsigned int);
  47. bool (*need_apll_change)(unsigned int, unsigned int);
  48. void __iomem *cmu_regs;
  49. };
  50. #ifdef CONFIG_ARM_EXYNOS4210_CPUFREQ
  51. extern int exynos4210_cpufreq_init(struct exynos_dvfs_info *);
  52. #else
  53. static inline int exynos4210_cpufreq_init(struct exynos_dvfs_info *info)
  54. {
  55. return -EOPNOTSUPP;
  56. }
  57. #endif
  58. #ifdef CONFIG_ARM_EXYNOS4X12_CPUFREQ
  59. extern int exynos4x12_cpufreq_init(struct exynos_dvfs_info *);
  60. #else
  61. static inline int exynos4x12_cpufreq_init(struct exynos_dvfs_info *info)
  62. {
  63. return -EOPNOTSUPP;
  64. }
  65. #endif
  66. #ifdef CONFIG_ARM_EXYNOS5250_CPUFREQ
  67. extern int exynos5250_cpufreq_init(struct exynos_dvfs_info *);
  68. #else
  69. static inline int exynos5250_cpufreq_init(struct exynos_dvfs_info *info)
  70. {
  71. return -EOPNOTSUPP;
  72. }
  73. #endif
  74. #define EXYNOS4_CLKSRC_CPU 0x14200
  75. #define EXYNOS4_CLKMUX_STATCPU 0x14400
  76. #define EXYNOS4_CLKDIV_CPU 0x14500
  77. #define EXYNOS4_CLKDIV_CPU1 0x14504
  78. #define EXYNOS4_CLKDIV_STATCPU 0x14600
  79. #define EXYNOS4_CLKDIV_STATCPU1 0x14604
  80. #define EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT (16)
  81. #define EXYNOS4_CLKMUX_STATCPU_MUXCORE_MASK (0x7 << EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT)
  82. #define EXYNOS5_APLL_LOCK 0x00000
  83. #define EXYNOS5_APLL_CON0 0x00100
  84. #define EXYNOS5_CLKMUX_STATCPU 0x00400
  85. #define EXYNOS5_CLKDIV_CPU0 0x00500
  86. #define EXYNOS5_CLKDIV_CPU1 0x00504
  87. #define EXYNOS5_CLKDIV_STATCPU0 0x00600
  88. #define EXYNOS5_CLKDIV_STATCPU1 0x00604