cpu-freq.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* arch/arm/plat-s3c/include/plat/cpu-freq.h
  2. *
  3. * Copyright (c) 2006,2007 Simtec Electronics
  4. * http://armlinux.simtec.co.uk/
  5. * Ben Dooks <ben@simtec.co.uk>
  6. *
  7. * S3C CPU frequency scaling support - driver and board
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <linux/cpufreq.h>
  14. struct s3c_cpufreq_info;
  15. struct s3c_cpufreq_board;
  16. struct s3c_iotimings;
  17. struct s3c_freq {
  18. unsigned long fclk;
  19. unsigned long armclk;
  20. unsigned long hclk_tns; /* in 10ths of ns */
  21. unsigned long hclk;
  22. unsigned long pclk;
  23. };
  24. /* wrapper 'struct cpufreq_freqs' so that any drivers receiving the
  25. * notification can use this information that is not provided by just
  26. * having the core frequency alone.
  27. */
  28. struct s3c_cpufreq_freqs {
  29. struct cpufreq_freqs freqs;
  30. struct s3c_freq old;
  31. struct s3c_freq new;
  32. };
  33. #define to_s3c_cpufreq(_cf) container_of(_cf, struct s3c_cpufreq_freqs, freqs)
  34. struct s3c_clkdivs {
  35. int p_divisor; /* fclk / pclk */
  36. int h_divisor; /* fclk / hclk */
  37. int arm_divisor; /* not all cpus have this. */
  38. unsigned char dvs; /* using dvs mode to arm. */
  39. };
  40. #define PLLVAL(_m, _p, _s) (((_m) << 12) | ((_p) << 4) | (_s))
  41. struct s3c_pllval {
  42. unsigned long freq;
  43. unsigned long pll_reg;
  44. };
  45. struct s3c_cpufreq_config {
  46. struct s3c_freq freq;
  47. struct s3c_pllval pll;
  48. struct s3c_clkdivs divs;
  49. struct s3c_cpufreq_info *info; /* for core, not drivers */
  50. struct s3c_cpufreq_board *board;
  51. };
  52. /* s3c_cpufreq_board
  53. *
  54. * per-board configuraton information, such as memory refresh and
  55. * how to initialise IO timings.
  56. */
  57. struct s3c_cpufreq_board {
  58. unsigned int refresh; /* refresh period in ns */
  59. unsigned int auto_io:1; /* automatically init io timings. */
  60. unsigned int need_io:1; /* set if needs io timing support. */
  61. /* any non-zero field in here is taken as an upper limit. */
  62. struct s3c_freq max; /* frequency limits */
  63. };
  64. /* Things depending on frequency scaling. */
  65. #ifdef CONFIG_CPU_FREQ_S3C
  66. #define __init_or_cpufreq
  67. #else
  68. #define __init_or_cpufreq __init
  69. #endif
  70. /* Board functions */
  71. #ifdef CONFIG_CPU_FREQ_S3C
  72. extern int s3c_cpufreq_setboard(struct s3c_cpufreq_board *board);
  73. #else
  74. static inline int s3c_cpufreq_setboard(struct s3c_cpufreq_board *board)
  75. {
  76. return 0;
  77. }
  78. #endif /* CONFIG_CPU_FREQ_S3C */