clk-cpu.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright (c) 2014 Samsung Electronics Co., Ltd.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. *
  8. * Common Clock Framework support for all PLL's in Samsung platforms
  9. */
  10. #ifndef __SAMSUNG_CLK_CPU_H
  11. #define __SAMSUNG_CLK_CPU_H
  12. #include "clk.h"
  13. /**
  14. * struct exynos_cpuclk_data: config data to setup cpu clocks.
  15. * @prate: frequency of the primary parent clock (in KHz).
  16. * @div0: value to be programmed in the div_cpu0 register.
  17. * @div1: value to be programmed in the div_cpu1 register.
  18. *
  19. * This structure holds the divider configuration data for dividers in the CPU
  20. * clock domain. The parent frequency at which these divider values are valid is
  21. * specified in @prate. The @prate is the frequency of the primary parent clock.
  22. * For CPU clock domains that do not have a DIV1 register, the @div1 member
  23. * value is not used.
  24. */
  25. struct exynos_cpuclk_cfg_data {
  26. unsigned long prate;
  27. unsigned long div0;
  28. unsigned long div1;
  29. };
  30. /**
  31. * struct exynos_cpuclk: information about clock supplied to a CPU core.
  32. * @hw: handle between CCF and CPU clock.
  33. * @alt_parent: alternate parent clock to use when switching the speed
  34. * of the primary parent clock.
  35. * @ctrl_base: base address of the clock controller.
  36. * @lock: cpu clock domain register access lock.
  37. * @cfg: cpu clock rate configuration data.
  38. * @num_cfgs: number of array elements in @cfg array.
  39. * @clk_nb: clock notifier registered for changes in clock speed of the
  40. * primary parent clock.
  41. * @flags: configuration flags for the CPU clock.
  42. *
  43. * This structure holds information required for programming the CPU clock for
  44. * various clock speeds.
  45. */
  46. struct exynos_cpuclk {
  47. struct clk_hw hw;
  48. struct clk_hw *alt_parent;
  49. void __iomem *ctrl_base;
  50. spinlock_t *lock;
  51. const struct exynos_cpuclk_cfg_data *cfg;
  52. const unsigned long num_cfgs;
  53. struct notifier_block clk_nb;
  54. unsigned long flags;
  55. /* The CPU clock registers have DIV1 configuration register */
  56. #define CLK_CPU_HAS_DIV1 (1 << 0)
  57. /* When ALT parent is active, debug clocks need safe divider values */
  58. #define CLK_CPU_NEEDS_DEBUG_ALT_DIV (1 << 1)
  59. /* The CPU clock registers have Exynos5433-compatible layout */
  60. #define CLK_CPU_HAS_E5433_REGS_LAYOUT (1 << 2)
  61. };
  62. extern int __init exynos_register_cpu_clock(struct samsung_clk_provider *ctx,
  63. unsigned int lookup_id, const char *name,
  64. const char *parent, const char *alt_parent,
  65. unsigned long offset,
  66. const struct exynos_cpuclk_cfg_data *cfg,
  67. unsigned long num_cfgs, unsigned long flags);
  68. #endif /* __SAMSUNG_CLK_CPU_H */