clock.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Clock control driver for Freescale STMP37XX/STMP378X - internal header file
  3. *
  4. * Author: Vitaly Wool <vital@embeddedalley.com>
  5. *
  6. * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved.
  7. * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved.
  8. */
  9. /*
  10. * The code contained herein is licensed under the GNU General Public
  11. * License. You may obtain a copy of the GNU General Public License
  12. * Version 2 or later at the following locations:
  13. *
  14. * http://www.opensource.org/licenses/gpl-license.html
  15. * http://www.gnu.org/copyleft/gpl.html
  16. */
  17. #ifndef __ARCH_ARM_STMX3XXX_CLOCK_H__
  18. #define __ARCH_ARM_STMX3XXX_CLOCK_H__
  19. #ifndef __ASSEMBLER__
  20. struct clk_ops {
  21. int (*enable) (struct clk *);
  22. int (*disable) (struct clk *);
  23. long (*get_rate) (struct clk *);
  24. long (*round_rate) (struct clk *, u32);
  25. int (*set_rate) (struct clk *, u32);
  26. int (*set_parent) (struct clk *, struct clk *);
  27. };
  28. struct clk {
  29. struct clk *parent;
  30. u32 rate;
  31. u32 flags;
  32. u8 scale_shift;
  33. u8 enable_shift;
  34. u8 bypass_shift;
  35. u8 busy_bit;
  36. s8 usage;
  37. int enable_wait;
  38. int enable_negate;
  39. u32 saved_div;
  40. void __iomem *enable_reg;
  41. void __iomem *scale_reg;
  42. void __iomem *bypass_reg;
  43. void __iomem *busy_reg;
  44. struct clk_ops *ops;
  45. };
  46. #endif /* __ASSEMBLER__ */
  47. /* Flags */
  48. #define RATE_PROPAGATES (1<<0)
  49. #define NEEDS_INITIALIZATION (1<<1)
  50. #define PARENT_SET_RATE (1<<2)
  51. #define FIXED_RATE (1<<3)
  52. #define ENABLED (1<<4)
  53. #define NEEDS_SET_PARENT (1<<5)
  54. #endif