clock.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Low level clock header file for Telechips TCC architecture
  3. * (C) 2010 Hans J. Koch <hjk@linutronix.de>
  4. *
  5. * Licensed under the GPL v2.
  6. */
  7. #ifndef __ASM_ARCH_TCC_CLOCK_H__
  8. #define __ASM_ARCH_TCC_CLOCK_H__
  9. #ifndef __ASSEMBLY__
  10. struct clk {
  11. struct clk *parent;
  12. /* id number of a root clock, 0 for normal clocks */
  13. int root_id;
  14. /* Reference count of clock enable/disable */
  15. int refcount;
  16. /* Address of associated BCLKCTRx register. Must be set. */
  17. void __iomem *bclkctr;
  18. /* Bit position for BCLKCTRx. Must be set. */
  19. int bclk_shift;
  20. /* Address of ACLKxxx register, if any. */
  21. void __iomem *aclkreg;
  22. /* get the current clock rate (always a fresh value) */
  23. unsigned long (*get_rate) (struct clk *);
  24. /* Function ptr to set the clock to a new rate. The rate must match a
  25. supported rate returned from round_rate. Leave blank if clock is not
  26. programmable */
  27. int (*set_rate) (struct clk *, unsigned long);
  28. /* Function ptr to round the requested clock rate to the nearest
  29. supported rate that is less than or equal to the requested rate. */
  30. unsigned long (*round_rate) (struct clk *, unsigned long);
  31. /* Function ptr to enable the clock. Leave blank if clock can not
  32. be gated. */
  33. int (*enable) (struct clk *);
  34. /* Function ptr to disable the clock. Leave blank if clock can not
  35. be gated. */
  36. void (*disable) (struct clk *);
  37. /* Function ptr to set the parent clock of the clock. */
  38. int (*set_parent) (struct clk *, struct clk *);
  39. };
  40. int clk_register(struct clk *clk);
  41. void clk_unregister(struct clk *clk);
  42. #endif /* __ASSEMBLY__ */
  43. #endif /* __ASM_ARCH_MXC_CLOCK_H__ */