clk.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #ifndef __MACH_IMX_CLK_H
  2. #define __MACH_IMX_CLK_H
  3. #include <linux/spinlock.h>
  4. #include <linux/clk-provider.h>
  5. #include <mach/clock.h>
  6. struct clk *imx_clk_pllv1(const char *name, const char *parent,
  7. void __iomem *base);
  8. struct clk *imx_clk_pllv2(const char *name, const char *parent,
  9. void __iomem *base);
  10. enum imx_pllv3_type {
  11. IMX_PLLV3_GENERIC,
  12. IMX_PLLV3_SYS,
  13. IMX_PLLV3_USB,
  14. IMX_PLLV3_AV,
  15. IMX_PLLV3_ENET,
  16. IMX_PLLV3_MLB,
  17. };
  18. struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
  19. const char *parent_name, void __iomem *base, u32 gate_mask,
  20. u32 div_mask);
  21. struct clk *clk_register_gate2(struct device *dev, const char *name,
  22. const char *parent_name, unsigned long flags,
  23. void __iomem *reg, u8 bit_idx,
  24. u8 clk_gate_flags, spinlock_t *lock);
  25. static inline struct clk *imx_clk_gate2(const char *name, const char *parent,
  26. void __iomem *reg, u8 shift)
  27. {
  28. return clk_register_gate2(NULL, name, parent, CLK_SET_RATE_PARENT, reg,
  29. shift, 0, &imx_ccm_lock);
  30. }
  31. struct clk *imx_clk_pfd(const char *name, const char *parent_name,
  32. void __iomem *reg, u8 idx);
  33. struct clk *imx_clk_busy_divider(const char *name, const char *parent_name,
  34. void __iomem *reg, u8 shift, u8 width,
  35. void __iomem *busy_reg, u8 busy_shift);
  36. struct clk *imx_clk_busy_mux(const char *name, void __iomem *reg, u8 shift,
  37. u8 width, void __iomem *busy_reg, u8 busy_shift,
  38. const char **parent_names, int num_parents);
  39. static inline struct clk *imx_clk_fixed(const char *name, int rate)
  40. {
  41. return clk_register_fixed_rate(NULL, name, NULL, CLK_IS_ROOT, rate);
  42. }
  43. static inline struct clk *imx_clk_divider(const char *name, const char *parent,
  44. void __iomem *reg, u8 shift, u8 width)
  45. {
  46. return clk_register_divider(NULL, name, parent, CLK_SET_RATE_PARENT,
  47. reg, shift, width, 0, &imx_ccm_lock);
  48. }
  49. static inline struct clk *imx_clk_gate(const char *name, const char *parent,
  50. void __iomem *reg, u8 shift)
  51. {
  52. return clk_register_gate(NULL, name, parent, CLK_SET_RATE_PARENT, reg,
  53. shift, 0, &imx_ccm_lock);
  54. }
  55. static inline struct clk *imx_clk_mux(const char *name, void __iomem *reg,
  56. u8 shift, u8 width, const char **parents, int num_parents)
  57. {
  58. return clk_register_mux(NULL, name, parents, num_parents, 0, reg, shift,
  59. width, 0, &imx_ccm_lock);
  60. }
  61. static inline struct clk *imx_clk_fixed_factor(const char *name,
  62. const char *parent, unsigned int mult, unsigned int div)
  63. {
  64. return clk_register_fixed_factor(NULL, name, parent,
  65. CLK_SET_RATE_PARENT, mult, div);
  66. }
  67. #endif