common.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Marvell EBU SoC common clock handling
  3. *
  4. * Copyright (C) 2012 Marvell
  5. *
  6. * Gregory CLEMENT <gregory.clement@free-electrons.com>
  7. * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
  8. * Andrew Lunn <andrew@lunn.ch>
  9. *
  10. * This file is licensed under the terms of the GNU General Public
  11. * License version 2. This program is licensed "as is" without any
  12. * warranty of any kind, whether express or implied.
  13. */
  14. #ifndef __CLK_MVEBU_COMMON_H_
  15. #define __CLK_MVEBU_COMMON_H_
  16. #include <linux/kernel.h>
  17. extern spinlock_t ctrl_gating_lock;
  18. struct device_node;
  19. struct coreclk_ratio {
  20. int id;
  21. const char *name;
  22. };
  23. struct coreclk_soc_desc {
  24. u32 (*get_tclk_freq)(void __iomem *sar);
  25. u32 (*get_cpu_freq)(void __iomem *sar);
  26. void (*get_clk_ratio)(void __iomem *sar, int id, int *mult, int *div);
  27. u32 (*get_refclk_freq)(void __iomem *sar);
  28. bool (*is_sscg_enabled)(void __iomem *sar);
  29. u32 (*fix_sscg_deviation)(u32 system_clk);
  30. const struct coreclk_ratio *ratios;
  31. int num_ratios;
  32. };
  33. struct clk_gating_soc_desc {
  34. const char *name;
  35. const char *parent;
  36. int bit_idx;
  37. unsigned long flags;
  38. };
  39. void __init mvebu_coreclk_setup(struct device_node *np,
  40. const struct coreclk_soc_desc *desc);
  41. void __init mvebu_clk_gating_setup(struct device_node *np,
  42. const struct clk_gating_soc_desc *desc);
  43. /*
  44. * This function is shared among the Kirkwood, Armada 370, Armada XP
  45. * and Armada 375 SoC
  46. */
  47. u32 kirkwood_fix_sscg_deviation(u32 system_clk);
  48. #endif