clock.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * linux/include/asm-arm/arch-omap/clock.h
  3. *
  4. * Copyright (C) 2004 - 2005 Nokia corporation
  5. * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
  6. * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #ifndef __ARCH_ARM_OMAP_CLOCK_H
  13. #define __ARCH_ARM_OMAP_CLOCK_H
  14. struct module;
  15. struct clk {
  16. struct list_head node;
  17. struct module *owner;
  18. const char *name;
  19. int id;
  20. struct clk *parent;
  21. unsigned long rate;
  22. __u32 flags;
  23. void __iomem *enable_reg;
  24. __u8 enable_bit;
  25. __u8 rate_offset;
  26. __u8 src_offset;
  27. __s8 usecount;
  28. void (*recalc)(struct clk *);
  29. int (*set_rate)(struct clk *, unsigned long);
  30. long (*round_rate)(struct clk *, unsigned long);
  31. void (*init)(struct clk *);
  32. int (*enable)(struct clk *);
  33. void (*disable)(struct clk *);
  34. };
  35. struct clk_functions {
  36. int (*clk_enable)(struct clk *clk);
  37. void (*clk_disable)(struct clk *clk);
  38. long (*clk_round_rate)(struct clk *clk, unsigned long rate);
  39. int (*clk_set_rate)(struct clk *clk, unsigned long rate);
  40. int (*clk_set_parent)(struct clk *clk, struct clk *parent);
  41. struct clk * (*clk_get_parent)(struct clk *clk);
  42. void (*clk_allow_idle)(struct clk *clk);
  43. void (*clk_deny_idle)(struct clk *clk);
  44. };
  45. extern unsigned int mpurate;
  46. extern int clk_init(struct clk_functions * custom_clocks);
  47. extern int clk_register(struct clk *clk);
  48. extern void clk_unregister(struct clk *clk);
  49. extern void propagate_rate(struct clk *clk);
  50. extern void followparent_recalc(struct clk * clk);
  51. extern void clk_allow_idle(struct clk *clk);
  52. extern void clk_deny_idle(struct clk *clk);
  53. extern int clk_get_usecount(struct clk *clk);
  54. /* Clock flags */
  55. #define RATE_CKCTL (1 << 0) /* Main fixed ratio clocks */
  56. #define RATE_FIXED (1 << 1) /* Fixed clock rate */
  57. #define RATE_PROPAGATES (1 << 2) /* Program children too */
  58. #define VIRTUAL_CLOCK (1 << 3) /* Composite clock from table */
  59. #define ALWAYS_ENABLED (1 << 4) /* Clock cannot be disabled */
  60. #define ENABLE_REG_32BIT (1 << 5) /* Use 32-bit access */
  61. #define VIRTUAL_IO_ADDRESS (1 << 6) /* Clock in virtual address */
  62. #define CLOCK_IDLE_CONTROL (1 << 7)
  63. #define CLOCK_NO_IDLE_PARENT (1 << 8)
  64. #define DELAYED_APP (1 << 9) /* Delay application of clock */
  65. #define CONFIG_PARTICIPANT (1 << 10) /* Fundamental clock */
  66. #define CM_MPU_SEL1 (1 << 11) /* Domain divider/source */
  67. #define CM_DSP_SEL1 (1 << 12)
  68. #define CM_GFX_SEL1 (1 << 13)
  69. #define CM_MODEM_SEL1 (1 << 14)
  70. #define CM_CORE_SEL1 (1 << 15) /* Sets divider for many */
  71. #define CM_CORE_SEL2 (1 << 16) /* sets parent for GPT */
  72. #define CM_WKUP_SEL1 (1 << 17)
  73. #define CM_PLL_SEL1 (1 << 18)
  74. #define CM_PLL_SEL2 (1 << 19)
  75. #define CM_SYSCLKOUT_SEL1 (1 << 20)
  76. #define CLOCK_IN_OMAP310 (1 << 21)
  77. #define CLOCK_IN_OMAP730 (1 << 22)
  78. #define CLOCK_IN_OMAP1510 (1 << 23)
  79. #define CLOCK_IN_OMAP16XX (1 << 24)
  80. #define CLOCK_IN_OMAP242X (1 << 25)
  81. #define CLOCK_IN_OMAP243X (1 << 26)
  82. #endif