memoryCall.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * linux/arch/arm/mach-omap1/clock.h
  3. *
  4. * Copyright (C) 2004 - 2005, 2009 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_MACH_OMAP1_CLOCK_H
  13. #define __ARCH_ARM_MACH_OMAP1_CLOCK_H
  14. #include <linux/clk.h>
  15. #include <linux/list.h>
  16. #include <linux/clkdev.h>
  17. struct module;
  18. struct clk;
  19. struct omap_clk {
  20. u16 cpu;
  21. struct clk_lookup lk;
  22. };
  23. #define CLK(dev, con, ck, cp) \
  24. { \
  25. .cpu = cp, \
  26. .lk = { \
  27. .dev_id = dev, \
  28. .con_id = con, \
  29. .clk = ck, \
  30. }, \
  31. }
  32. /* Platform flags for the clkdev-OMAP integration code */
  33. #define CK_310 (1 << 0)
  34. #define CK_7XX (1 << 1) /* 7xx, 850 */
  35. #define CK_1510 (1 << 2)
  36. #define CK_16XX (1 << 3) /* 16xx, 17xx, 5912 */
  37. #define CK_1710 (1 << 4) /* 1710 extra for rate selection */
  38. /* Temporary, needed during the common clock framework conversion */
  39. #define __clk_get_name(clk) (clk->name)
  40. #define __clk_get_parent(clk) (clk->parent)
  41. #define __clk_get_rate(clk) (clk->rate)
  42. /**
  43. * struct clkops - some clock function pointers
  44. * @enable: fn ptr that enables the current clock in hardware
  45. * @disable: fn ptr that enables the current clock in hardware
  46. * @find_idlest: function returning the IDLEST register for the clock's IP blk
  47. * @find_companion: function returning the "companion" clk reg for the clock
  48. * @allow_idle: fn ptr that enables autoidle for the current clock in hardware
  49. * @deny_idle: fn ptr that disables autoidle for the current clock in hardware
  50. *
  51. * A "companion" clk is an accompanying clock to the one being queried
  52. * that must be enabled for the IP module connected to the clock to
  53. * become accessible by the hardware. Neither @find_idlest nor
  54. * @find_companion should be needed; that information is IP
  55. * block-specific; the hwmod code has been created to handle this, but
  56. * until hwmod data is ready and drivers have been converted to use PM
  57. * runtime calls in place of clk_enable()/clk_disable(), @find_idlest and
  58. * @find_companion must, unfortunately, remain.
  59. */
  60. struct clkops {
  61. int (*enable)(struct clk *);
  62. void (*disable)(struct clk *);
  63. void (*find_idlest)(struct clk *, void __iomem **,
  64. u8 *, u8 *);
  65. void (*find_companion)(struct clk *, void __iomem **,
  66. u8 *);
  67. void (*allow_idle)(struct clk *);
  68. void (*deny_idle)(struct clk *);
  69. };
  70. /*
  71. * struct clk.flags possibilities
  72. *
  73. * XXX document the rest of the clock flags here
  74. *
  75. * CLOCK_CLKOUTX2: (OMAP4 only) DPLL CLKOUT and CLKOUTX2 GATE_CTRL
  76. * bits share the same register. This flag allows the
  77. * omap4_dpllmx*() code to determine which GATE_CTRL bit field
  78. * should be used. This is a temporary solution - a better approach
  79. * would be to associate clock type-specific data with the clock,
  80. * similar to the struct dpll_data approach.
  81. */
  82. #define ENABLE_REG_32BIT (1 << 0) /* Use 32-bit access */
  83. #define CLOCK_IDLE_CONTROL (1 << 1)
  84. #define CLOCK_NO_IDLE_PARENT (1 << 2)
  85. #define ENABLE_ON_INIT (1 << 3) /* Enable upon framework init */
  86. #define INVERT_ENABLE (1 << 4) /* 0 enables, 1 disables */
  87. #define CLOCK_CLKOUTX2 (1 << 5)
  88. /**
  89. * struct clk - OMAP struct clk
  90. * @node: list_head connecting this clock into the full clock list
  91. * @ops: struct clkops * for this clock
  92. * @name: the name of the clock in the hardware (used in hwmod data and debug)
  93. * @parent: pointer to this clock's parent struct clk
  94. * @children: list_head connecting to the child clks' @sibling list_heads
  95. * @sibling: list_head connecting this clk to its parent clk's @children
  96. * @rate: current clock rate
  97. * @enable_reg: register to write to enable the clock (see @enable_bit)
  98. * @recalc: fn ptr that returns the clock's current rate
  99. * @set_rate: fn ptr that can change the clock's current rate
  100. * @round_rate: fn ptr that can round the clock's current rate
  101. * @init: fn ptr to do clock-specific initialization
  102. * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg)
  103. * @usecount: number of users that have requested this clock to be enabled
  104. * @fixed_div: when > 0, this clock's rate is its parent's rate / @fixed_div
  105. * @flags: see "struct clk.flags possibilities" above
  106. * @rate_offset: bitshift for rate selection bitfield (OMAP1 only)
  107. * @src_offset: bitshift for source selection bitfield (OMAP1 only)
  108. *
  109. * XXX @rate_offset, @src_offset should probably be removed and OMAP1
  110. * clock code converted to use clksel.
  111. *
  112. * XXX @usecount is poorly named. It should be "enable_count" or
  113. * something similar. "users" in the description refers to kernel
  114. * code (core code or drivers) that have called clk_enable() and not
  115. * yet called clk_disable(); the usecount of parent clocks is also
  116. * incremented by the clock code when clk_enable() is called on child
  117. * clocks and decremented by the clock code when clk_disable() is