clock.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved.
  3. * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation; either version 2
  8. * of the License, or (at your option) any later version.
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  17. * MA 02110-1301, USA.
  18. */
  19. #ifndef __ASM_ARCH_MXC_CLOCK_H__
  20. #define __ASM_ARCH_MXC_CLOCK_H__
  21. #ifndef __ASSEMBLY__
  22. #include <linux/list.h>
  23. struct module;
  24. struct clk {
  25. struct list_head node;
  26. struct module *owner;
  27. const char *name;
  28. int id;
  29. /* Source clock this clk depends on */
  30. struct clk *parent;
  31. /* Secondary clock to enable/disable with this clock */
  32. struct clk *secondary;
  33. /* Reference count of clock enable/disable */
  34. __s8 usecount;
  35. /* Register bit position for clock's enable/disable control. */
  36. u8 enable_shift;
  37. /* Register address for clock's enable/disable control. */
  38. void __iomem *enable_reg;
  39. u32 flags;
  40. /* get the current clock rate (always a fresh value) */
  41. unsigned long (*get_rate) (struct clk *);
  42. /* Function ptr to set the clock to a new rate. The rate must match a
  43. supported rate returned from round_rate. Leave blank if clock is not
  44. programmable */
  45. int (*set_rate) (struct clk *, unsigned long);
  46. /* Function ptr to round the requested clock rate to the nearest
  47. supported rate that is less than or equal to the requested rate. */
  48. unsigned long (*round_rate) (struct clk *, unsigned long);
  49. /* Function ptr to enable the clock. Leave blank if clock can not
  50. be gated. */
  51. int (*enable) (struct clk *);
  52. /* Function ptr to disable the clock. Leave blank if clock can not
  53. be gated. */
  54. void (*disable) (struct clk *);
  55. /* Function ptr to set the parent clock of the clock. */
  56. int (*set_parent) (struct clk *, struct clk *);
  57. };
  58. int clk_register(struct clk *clk);
  59. void clk_unregister(struct clk *clk);
  60. #endif /* __ASSEMBLY__ */
  61. #endif /* __ASM_ARCH_MXC_CLOCK_H__ */